offline mode: enter name=value pairs ??

They have: 8 posts

Joined: Mar 2000

Thanks so this is also neccessary if there is no variable ??

What's the meaning of addin ?biship=true
if there is no variale biship ?

Thanks

------------------
Meta-Saerch ?
http://www.waatleeft.lu

They have: 568 posts

Joined: Nov 1999

Possibly something for the module, but i doubt it. isn't command line arguments supposed to be $ARG[0] ?

They have: 8 posts

Joined: Mar 2000

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.

Anybody can help ?

------------------
Meta-Saerch ?
http://www.waatleeft.lu

They have: 122 posts

Joined: Jun 2000

Where you normally enter variables through script.cgi?variable=value, when you run it in offline mode, you need to specify those variables on the command line, e.g. 'script.cgi variable=value'

-rob

Rob Radez
OSInvestor.com

They have: 122 posts

Joined: Jun 2000

command line arguments get shoved into @ARGV, but in this case, you'd have to do 'addin mytest=whatever' because you're trying to get the parameter 'mytest' from the browser. variable isn't the right word for it, but it seemed like a simple way to describe it. you can pass parameters to a perl script. when doing it with a browser, you usually do script.cgi?node=blah, where the parameter's name is 'node' and its value is 'blah'. when you run the script on the command line, you can't do 'script.cgi?node=blah', so you must do 'script.cgi node=blah' and perl figures out that that is the parameter. in a sense, when you do 'script.cgi?node=blah' that is the argument for the script, but since you're using param($param_name), it figures out that the list of $param=$value pairs gets separated and uses $param as the parameter name and $value as that parameter's value. thus going to 'http://blah.com/script.cgi?node=blah&test=sure&blah=why_not' (which is the same as running 'script.cgi node=blah test=sure halb=why_not' on the command line) ends up with three parameters that you pass in: node, test, and halb, along with the three (respective) values for those parameters: blah, sure, and why_not. you're using param() from CGI.pm which simplifies this because otherwise you'd need to check @ARGV to see if there were any valid parameters passed (in the form $param=$value) to the script, and make sure that it all fit, and it gets all complicated and messy and using CGI.pm is just loads easier.

Rob Radez
OSInvestor.com

They have: 8 posts

Joined: Mar 2000

First I'd like thank you for the complete and helpfull answer.

Neitherway I am no expert at perl, this is how I tried to run it :

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 wents fine. (the files get's printed,though the "variable" does not exist)

Yeah I used "name=value" but it works if used in the same dir, if call from behond home, it doesn't ?

------------------
Meta-Saerch ?
http://www.waatleeft.lu

They have: 8 posts

Joined: Mar 2000

Hmm just relooked over the script.
<<$mytest =$q->param(mytest);>>

Couldn't I simply comment this line out, as it seems not to be needed ??

------------------
Meta-Saerch ?
http://www.waatleeft.lu

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.