Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

prototyle mismatch error using LWP::Simple and CGI.

( #182540=categorized question: print w/ replies, xml ) Need Help??
Contributed by silent11 on Jul 17, 2002 at 18:20 UTC
Q&A  > subroutines


Description:

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

Answer: prototyle mismatch error using LWP::Simple and CGI.
contributed by japhy

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(...);
Answer: prototyle mismatch error using LWP::Simple and CGI.
contributed by rjimlad

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.

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (5)
    As of 2014-11-29 05:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (203 votes), past polls