Subject: | perl 5.12 'Use of uninitialized value in uc ....' warnings |
Using perl 5.12 in Debian wheezy, perl -v:
This is perl 5, version 12, subversion 4 (v5.12.4) built for
x86_64-linux-gnu-thread-multi
I get "Use of unitialized value in uc ..." warnings, which actually
cause hard failures in the environment I'm working with
See below (thanks for the nice work here in REST::Utils btw :-)
make Makefile.PL
make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-signature.t ......... skipped: Set the environment variable
TEST_SIGNATURE to enable this test.
t/01-load.t .............. 1/1 # Testing REST::Utils 0.4, Perl 5.012004,
/usr/bin/perl
t/01-load.t .............. ok
t/content-negotiation.t .. Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
t/content-negotiation.t .. 1/10 Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
t/content-negotiation.t .. ok
t/get-body.t ............. Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
t/get-body.t ............. 1/10 Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 360.
t/get-body.t ............. ok
t/http-tunnel.t .......... 1/26 Use of uninitialized value in uc at
/usr/local/src/github.com/REST-Utils/blib/lib/REST/Utils.pm line 359.
t/http-tunnel.t .......... ok
t/mime-parse.t ........... ok
All tests successful.
Files=6, Tests=74, 1 wallclock secs ( 0.06 usr 0.01 sys + 0.89 cusr
0.07 csys = 1.03 CPU)
Result: PASS
Subject: | REST-Utils.diff |
diff --git a/lib/REST/Utils.pm b/lib/REST/Utils.pm
index a460129..ebdaecb 100644
--- a/lib/REST/Utils.pm
+++ b/lib/REST/Utils.pm
@@ -356,11 +356,12 @@ attempted, it will be ignored.
sub request_method {
my ($cgi) = @_;
- my $real_method = uc $cgi->request_method() || q{};
+ my $real_method = uc ($cgi->request_method() || q{});
my $tunnel_method =
uc( $cgi->http('X-HTTP-Method-Override')
|| $cgi->url_param('_method')
- || $cgi->param('_method') )
+ || $cgi->param('_method')
+ || q{} )
|| undef;
return $real_method if !defined $tunnel_method;