CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
(offline mode: enter name=value pairs on standard input)

 



Thierry
Deleted

Mar 9, 2000, 9:01 AM

Post #1 of 3 (1032 views)
(offline mode: enter name=value pairs on standard input) Can't Post

This is the CronMessage (to my mail) I get once I let that script run through Cron.
(offline mode: enter name=value pairs on standard input)

The script :
#!/usr/bin/perl
use English;
use CGI;
use integer;
require LWP::UserAgent;


$q = new CGI;
#print $q->header;
$mytest =$q->param(mytest);


$ssi = "no";
$ua = new LWP::UserAgent;
$the_cgi = CGI->new;
$domain = "www.wort.lu/w_aktu/default.htm";
#$domain = $ENV{'QUERY_STRING'}; # ex. "script.cgi?yahoo.com";
$begin = "http://";
$data = $begin . $domain;
$breakupa = "<A HREF=\"/w_ak"; # If this string is in a line, that line will be printed.
$breakupb = "</A>"; # If this string is in a line, that line will be printed.
$breakupc = "<IMG BORDER=0"; # If this string is in a line, that line will be printed.

$replacea = "<A HREF=\"/w_aktu/";
$replaceb = "<font face=\"Arial, Helvetica, sans-serif\" size=\"1\"><A
HREF=\"http://www.wort.lu/w_aktu/";
$replacec = "</A>";
$replaced = "</A><BR>";
$replacee = "<BR></A><BR>";
$replacef = "</A>";


$numheads = "900"; # Number of headlines you want to be printed Times Three!
$footer = "";
$lookup = new HTTP::Request 'GET', "$data";
$response = $ua->request($lookup);
@lines = split (/\n/, $response->content);


$logpath = "../../wort2.txt";
open (LOG, ">$logpath");

$i = 0;
foreach $line (@lines)
{
if ($line =~ /$breakupc/ && $i < $numheads)
{
$i += 1;
}
elsif ($line =~ /$breakupa/ && $i < $numheads)
{
$line =~ s/$replacea/$replaceb/;

print LOG "$line";
$i += 1;
}
elsif ($line =~ /$breakupb/ && $i < $numheads)
{
$line =~ s/$replacec/$replaced/;
$line =~ s/$replacee/$replacef/;
print LOG "$line";
$i += 1;

}
}
exit;
close(LOG);

.........


It parses through html then writes to an File. If I run it manually (from my browser) it
does work, but from cron it just generates that error message.


Then I entered this line in the crontab
*/2 * * * * perl /home/waatleef/public_html/cgi-bin/newsg/wortcron.pl name=value

So this should run wortcron.pl every 2 minutes, but it does not _not_.

If I go into the dir /home/waatleef/public_html/cgi-bin/newsg/
and run "perl wortcron.pl name=value" ;
everything runs fine (file is written, no error message)

Anybody knows a way arround it


japhy
Enthusiast

Mar 8, 2000, 10:37 PM

Post #2 of 3 (1032 views)
Re: (offline mode: enter name=value pairs on standard input) [In reply to] Can't Post

Well, you never use the CGI module, so get rid of it, and the $q variable, and the $mytest variable, and the $the_cgi variable. The reason it's asking you is because you call param(), which expects input, and when it realizes you're calling the program at a command prompt, it asks for YOU to give it input.

Since your program needs no input, remove the CGI module from it.


Thierry
Deleted

Mar 10, 2000, 11:05 AM

Post #3 of 3 (1032 views)
Re: (offline mode: enter name=value pairs on standard input) [In reply to] Can't Post

Hmm strange I cut everything off like you said :
Deleted following lines

$q = new CGI;
#print $q->header;
$mytest =$q->param(mytest);
$the_cgi = CGI->new;

And it STILL gives me the same error message ?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives