Subject: | Uninitialized value . . . HTTP/Recorder/Logger.pm line 171 (PATCH) |
Logger.pm generates warning messages when empty form values are used.
Here is a test program:
[[
$ cat ./hproxy.pl
#! /usr/bin/perl -w
# Simple http proxy.
use HTTP::Proxy;
use HTTP::Recorder;
my $proxy = HTTP::Proxy->new( port => 8088 );
# create a new HTTP::Recorder object
my $agent = new HTTP::Recorder;
# set the log file (optional)
$agent->file("/tmp/proxylog.txt");
# set HTTP::Recorder as the agent for the proxy
$proxy->agent( $agent );
# start the proxy
$proxy->start();
1;
]]
And here is the result of running it:
[[
$ ./hproxy.pl
Use of uninitialized value in substitution (s///) at
/usr/lib/perl5/site_perl/5.
8/HTTP/Recorder/Logger.pm line 171.
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site
_perl/5.8/HTTP/Recorder/Logger.pm line 173.
Use of uninitialized value in substitution (s///) at
/usr/lib/perl5/site_perl/5.
8/HTTP/Recorder/Logger.pm line 171.
Use of uninitialized value in concatenation (.) or string at
/usr/lib/perl5/site
_perl/5.8/HTTP/Recorder/Logger.pm line 173.
. . . .
]]
Adding the following line before line 171 in Logger.pm seems to fix the
problem:
[[
$ diff Logger.pm.old Logger.pm
170a171
Show quoted text
> $args{value} = '' if !defined($args{value});
]]
I am currently running:
[[
$ uname -a
CYGWIN_NT-5.1 dbooth-8510w 1.5.25(0.156/4/2) 2008-05-26 20:37 i686 Cygwin
$ perl -v
This is perl, v5.8.8 built for cygwin-thread-multi-64int
(with 8 registered patches, see perl -V for more detail)
. . . .
]]