CC: | zahatski [...] gmail.com |
Subject: | [PATCH] Use of uninitialized value in split in CGI.pm in Accept() |
Very minor annoyance: when calling Accept() without args I get the
follow warning when the use CGI.pm from shell:
Use of uninitialized value in split
This is because Accept() doesn't check that the $self->http('accept')
return defined result before split.
This is a quick patch:
--- /usr/local/lib/perl5/site_perl/5.8.8/CGI.pm 2008-04-23
17:08:23.000000000 +0400
+++ CGI.pm 2008-06-04 15:58:15.000000000 +0400
@@ -2942,7 +2942,7 @@
my($self,$search) = self_or_CGI(@_);
my(%prefs,$type,$pref,$pat);
- my(@accept) = split(',',$self->http('accept'));
+ my(@accept) = defined $self->http('accept') ?
split(',',$self->http('accept')) : ();
foreach (@accept) {
($pref) = /q=(\d\.\d+|\d+)/;