Subject: | Variable $on_header is not available |
As mentioned in IRC:
Variable "$on_header" is not available at
/home/tom/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/Async/HTTP.pm line 401 (#1)
This should be enough to trigger it:
perl examples/GET.pl http://www.google.com
Moving the my $on_header declaration up a line fixes it - attached a
slightly rewritten patch which works for me locally.
cheers,
Tom
Subject: | Net-Async-HTTP-0.12-on_header.diff |
--- a/lib/Net/Async/HTTP.pm 2011-10-03 19:10:08.000000000 +0100
+++ b/lib/Net/Async/HTTP.pm 2011-10-08 15:27:50.235056997 +0100
@@ -338,8 +338,10 @@
my $self = shift;
my %args = @_;
- my $on_response = $args{on_response} or
- my $on_header = $args{on_header} or croak "Expected 'on_response' or 'on_header' as CODE ref";
+ my $on_response = $args{on_response};
+ my $on_header = $args{on_header};
+ croak "Expected 'on_response' or 'on_header' as CODE ref" unless $on_response || $on_header;
+
my $on_error = $args{on_error} or croak "Expected 'on_error' as a CODE ref";
my $request_body = $args{request_body};