LWP fails with PerlEXE
Gurusamy Sarathy (gsar@activestate.com)
Thu, 04 Feb 1999 17:24:43 -0800
On Thu, 04 Feb 1999 15:26:42 PST, Douglas Lankshear wrote:
>
>See PDK bug #62 for more info.
The bug is in fact in LWP. Try doing:
C:\> perl -we "use LWP::Protocol;"
Bareword "HTTP::Response" not allowed while "strict subs" in use at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 224.
Bareword found where operator expected at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 224, near "HTTP::Response RC_INTERNAL_SERVER_ERROR"
(Do you need to predeclare HTTP::Response?)
Bareword "HTTP::Response" not allowed while "strict subs" in use at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 262.
Bareword found where operator expected at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 262, near "HTTP::Response RC_INTERNAL_SERVER_ERROR"
(Do you need to predeclare HTTP::Response?)
syntax error at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 224, near "HTTP::Response RC_INTERNAL_SERVER_ERROR"
syntax error at E:\ACTIVEPERL\site\lib/LWP/Protocol.pm line 262, near "HTTP::Response RC_INTERNAL_SERVER_ERROR"
BEGIN failed--compilation aborted at -e line 1.
HTTP::Status does not export the RC_INTERNAL_SERVER_ERROR constant, while
LWP::Protocol thinks it does. Patch attached.
(I haven't yet tracked down why the error is not reported with
C<perl -we "use LWP::UserAgent;">. PerlEXE croaks correctly (as above)
for that.)
Sarathy
gsar@activestate.com
-----------------------------------8<-----------------------------------
--- Protocol.pm.dist Thu Feb 04 16:59:46 1999
+++ Protocol.pm Thu Feb 04 17:18:49 1999
@@ -42,7 +42,7 @@
use strict;
use Carp ();
-use HTTP::Status 'RC_INTERNAL_SERVER_ERROR';
+use HTTP::Status;
require HTML::HeadParser;
my %ImplementedBy = (); # scheme => classname
@@ -221,7 +221,7 @@
elsif (!ref($arg)) {
# filename
open(OUT, ">$arg") or
- return new HTTP::Response RC_INTERNAL_SERVER_ERROR,
+ return new HTTP::Response &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
"Cannot write to '$arg': $!";
binmode(OUT);
local($\) = ""; # ensure standard $OUTPUT_RECORD_SEPARATOR
@@ -259,7 +259,7 @@
}
}
else {
- return new HTTP::Response RC_INTERNAL_SERVER_ERROR,
+ return new HTTP::Response &HTTP::Status::RC_INTERNAL_SERVER_ERROR,
"Unexpected collect argument '$arg'";
}
$response;
End of Patch.