Hi all,

Yesterday I updated my LWP module from version 5.75 to the current 5.8
version. From this update, one of my scripts has stopped working.

The script creates a PUT request, specifying a subroutine as the
content, for dynamic content retrieval. The original code does:

     my $req = HTTP::Request->new("PUT", $url, $header, $readFunc);

But now it dies with a "Not a SCALAR reference" error.

I have been debugging the LWP code, and I have found the following
workaround:

     my $req = HTTP::Request->new("PUT", $url, $header, \$readFunc);

That is, pass the function reference, by reference.

Unfortunately, this change makes my script fail with older LWP versions.

My questions are:
Is there a more elegant workaround that do not break compatibility with
older LWP versions?
If not, and I put these two lines in an if-else sentence, comparing the
$LWP::VERSION value with a "threshold" , which exact version should I
compare to?



--
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.727 / Virus Database: 482 - Release Date: 27/07/2004



Reply via email to