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


The Cougar Ace tips over, Alaska


Thunderbird ignores Windows’ default printer setting


  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

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

Powered by WordPress & Theme by Anders Norén