silent11 has asked for the wisdom of the Perl Monks concerning the following question:

I get a 'prototype mismatch error' when I try to load both LWP::Simple and CGI ':standard' into the same script. How can I get around this?

I'm using
perl v5.6.1
LWP v5.51
CGI v2.752

Thanks in advance -

-Silent11

  • Comment on prototyle mismatch error using LWP::Simple and CGI.

Replies are listed 'Best First'.
Re: prototyle mismatch error using LWP::Simple and CGI.
by japhy (Canon) on Jul 17, 2002 at 18:54 UTC
    Both CGI and LWP::Simple export a 'head' function. If you aren't using LWP::Simple's head() function, only import what you want: use LWP::Simple 'get'; Otherwise:
    use CGI ':standard'; use LWP::Simple (); ... print LWP::Simple::head(...);
Re: prototyle mismatch error using LWP::Simple and CGI.
by rjimlad (Acolyte) on Jul 19, 2002 at 20:01 UTC
    Yes, the full error message is more-or-less self-explanatory. Personally, I'd just use CGI in OO mode, eg:
    use CGI; use LWP::Simple; my $cgi=new CGI; # LWP's head() print head(); # CGI's head print $cgi->head();
    ...and of course you can use 'require CGI' instead of 'use CGI', which could have potential benefits.