in reply to Re^2: Search for abcNUMBERdef, make it a variable, then do math?
in thread Search for abcNUMBERdef, make it a variable, then do math?

SSH spits out
root@wor [/home/site82/public_html/cgi-bin]# perl stats.cgi Prototype mismatch: sub main::head: none vs ($) at stats.cgi line 19 today: 0 (from ) last: 0 (from ) this: 0 (from ) yesterday: 0 (from )
The first part of the script is
if (length ($ENV{'QUERY_STRING'}) > 0){ $buffer = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $buffer); foreach $pair (@pairs){ ($name, $value) = split(/=/, $pair); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg +; $in{$name} = $value; } } my $id = param('id'); use LWP::Simple; $id2 = get ("http://www.domain.com/stats.php?id=$id");
and Line 19 is use LWP::Simple;

Replies are listed 'Best First'.
Re^4: Search for abcNUMBERdef, make it a variable, then do math?
by Anonyrnous Monk (Hermit) on Jan 22, 2011 at 13:28 UTC
    Prototype mismatch: sub main::head: none vs ($) at stats.cgi line 19

    See CAVEAT in the LWP::Simple docs:

    Note that if you are using both LWP::Simple and the very popular CGI.pm module, you may be importing a head function from each module, producing a warning like "Prototype mismatch: sub main::head ($) vs none". Get around this problem by just not importing LWP::Simple's head function, like so:

    use LWP::Simple qw(!head); use CGI qw(:standard); # then only CGI.pm defines a head()

    As for "The first part of the script is" part:  why are you parsing the QUERY_STRING yourself, when you're using CGI.pm anyway — as the warning and your line my $id = param('id') indicates?  CGI.pm does the parsing already, so you can just drop that code...