Subject: | LWP::Protocol::collect error handling |
In LWP::Protocol::collect method operator || used for error handling,
which causing 'die' case if $_[3] is '0'. Need to replace with 'or'
operator, which has lesser precedence.
--- Protocol.pm 2008-11-17 02:50:48.000000000 -0600
+++ /usr/local/share/perl/5.8.4/LWP/Protocol.pm 2008-11-17
02:35:09.000000000 -0600
@@ -101,17 +101,17 @@
$response->{default_add_content} = 1;
}
elsif (!ref($arg) && length($arg)) {
- open(my $fh, ">", $arg) || die "Can't write to '$arg': $!";
+ open(my $fh, ">", $arg) or die "Can't write to '$arg': $!";
binmode($fh);
push(@{$response->{handlers}{response_data}}, {
callback => sub {
- print $fh $_[3] || die "Can't write to '$arg': $!";
+ print $fh $_[3] or die "Can't write to '$arg': $!";
1;
},
});
push(@{$response->{handlers}{response_done}}, {
callback => sub {
- close($fh) || die "Can't write to '$arg': $!";
+ close($fh) or die "Can't write to '$arg': $!";
undef($fh);
},
});