Skip Menu |

This queue is for tickets about the Net-Async-HTTP CPAN distribution.

Report information
The Basics
Id: 102023
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: WolfSage [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.38



Subject: length() used on undefined values; causes warnings in perl <= 5.10.x
I've only seen this one so far; but I suspect there are others: Use of uninitialized value $final in length at lib/perl5/Net/Async/HTTP/Connection.pm line 440. From: my $final; if( $decoder and not eval { $final = $decoder->(); 1 } ) { $self->debug_printf( "ERROR decode failed" ); $f->fail( "Decode error $@", http => undef, $req ); $self->close; return undef; } $on_body_chunk->( $final ) if length $final; # <------- I suspect there might be more cases. It would be nice if these didn't warn on older Perls. Thanks, -- Matthew Horsfall (alh)
Attached is a patch to fix this case at least. I get no other warnings with the test suite after this is applied on perl-5.10.1
Subject: fix_length_warning.patch.txt
--- Net-Async-HTTP-0.37/lib/Net/Async/HTTP/Connection.pm 2014-12-13 15:08:07.000000000 +0000 +++ Net-Async-HTTP-0.37-b/lib/Net/Async/HTTP/Connection.pm 2015-02-24 14:55:38.000000000 +0000 @@ -436,7 +436,7 @@ return undef; } - $on_body_chunk->( $final ) if length $final; + $on_body_chunk->( $final ) if defined $final && length $final; my $response = $on_body_chunk->(); my $e = eval { $f->done( $response ) unless $f->is_cancelled; 1 } ? undef : $@;
Thanks, applied -- Paul Evans
Was released in 0.38 -- Paul Evans