You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/09/28 06:04:51 UTC

[patch CGI.pm] prevent some warnings

Hi Lincoln,

under perl 5.6.1 CGI.pm (3.05 and earlier) produces tons of warnings in 
this code:

CGI.pm:32226: my $seqno = unpack("%16C*",join('',localtime,values %ENV));

Apparently under perl 5.6 there could be %ENV entries which the key, but 
undef as a value. Here is the fix:

--- CGI.pm      2004-09-27 23:56:22.863001529 -0400
+++ CGI.pm.new  2004-09-27 23:59:44.451517025 -0400
@@ -3223,7 +3223,7 @@
            }

           # choose a relatively unpredictable tmpfile sequence number
-          my $seqno = unpack("%16C*",join('',localtime,values %ENV));
+          my $seqno = unpack("%16C*",join('',localtime, grep(defined, 
values %ENV)));
            for (my $cnt=10;$cnt>0;$cnt--) {
             next unless $tmpfile = new CGITempFile($seqno);
             $tmp = $tmpfile->as_string;

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html