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’shead
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 asLWP::Simple::head($url)
.
sv
Thanks!
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).