Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

prototyle mismatch error using LWP::Simple and CGI.

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


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 -


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';

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    [Corion]: A good weekstart to everybody!

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (6)
    As of 2018-06-18 08:21 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (109 votes). Check out past polls.