A windsurfing, CSS-grudging, IE-hating, web-developing, gigantic-machine-puzzling blog

Prototype mismatch: sub main::head ($) vs none

Turns out that when you use the LWP::Simple & CGI modules together in a Perl script, each has a conflicting head() function that throws that error. Who knew? Everyone who took the time to read the CAVEAT note at the end of the LWP::Simple docs, apparently:

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()

Then if you do need LWP::Simple’s head function, you can just call it as LWP::Simple::head($url).

Previous

The Cougar Ace tips over, Alaska

Next

Thunderbird ignores Windows’ default printer setting

2 Comments

  1. Safiqul

    I need to use both function CGI:: head($url ) and LWP::Simple::head($url). Then how should call and what will be the import code (use LWP::Simple).

Leave a Reply to sv Cancel reply

Your email address will not be published. Required fields are marked *

Powered by WordPress & Theme by Anders Norén