Skip Menu |

This queue is for tickets about the IO-Lambda CPAN distribution.

Report information
The Basics
Id: 48311
Status: resolved
Priority: 0/
Queue: IO-Lambda

People
Owner: Nobody in particular
Requestors: njh [...] bandsman.co.uk
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.11
Fixed in: (no value)



Subject: Can't locate object method "host" via package "URI::_generic"
This program crashes IO::Lambda with the cryptic error message 'Can't locate object method "host" via package "URI::_generic" at /usr/local/share/perl/5.10.0/IO/Lambda/HTTP.pm line 95.' #!/usr/bin/perl -wT use strict; use warnings; use diagnostics; use HTTP::Request; use IO::Lambda qw(:lambda); use IO::Lambda::HTTP qw(http_request); lambda { foreach my $req ( 'http://www.ennisbrassband.com/links.aspx', 'http://www.callingtontownband.com/onemoment.mp3', 'http://www.callingtontownband.com/whowants.mp3', 'http://www.callingtontownband.com/deep.mp3', 'http://www.callingtontownband.com/trel.mp3', 'http://www.callingtontownband.com/index.htm', 'http://www.callingtontownband.com/dambust.mp3', 'http://www.callingtontownband.com/freeworld.mp3', 'http://www.callingtontownband.com/ctbmarch.mp3', 'http://www.callingtontownband.com/largo.mp3', 'http://www.callingtontownband.com/rockout.mp3', 'http://www.callingtontownband.com/aces.mp3', 'http://www.templemoreband.com/Events.htm', 'http://www.templemoreband.com/Vacancies.htm', 'http://www.templemoreband.com/Gallery.htm', 'http://www.templemoreband.com/Members.htm', 'http://www.templemoreband.com/Musical%20Director.htm', 'http://www.templemoreband.com/Latest%20news.htm', 'http://www.templemoreband.com/Band%20History.htm', 'http://www.templemoreband.com/Audio.htm', 'http://www.rhylsilverband.co.uk/Links.html', 'http://www.rhylsilverband.co.uk/HomePage.html', 'http://www.rhylsilverband.co.uk/RSB%20Style%20Sheet.css', 'http://www.honitonband.co.uk/7.html', 'http://www.honitonband.co.uk/index.html', 'http://www.honitonband.co.uk/8.html', 'http://www.honitonband.co.uk/6.html', 'http://www.honitonband.co.uk/4.html', 'http://www.honitonband.co.uk/goodies/PageLayout/css/default.css', 'http://www.honitonband.co.uk/3.html', 'http://www.honitonband.co.uk/gronau_2008_22.html', 'http://www.honitonband.co.uk/5.html', 'http://www.honitonband.co.uk/site_map.html', 'http://www.honitonband.co.uk/10.html', 'http://www.honitonband.co.uk/9.html', 'http://www.honitonband.co.uk/2.html', 'http://www.honitonband.co.uk/19.html', 'http://www.stalybridgeoldband.org/page5.htm', 'http://www.stalybridgeoldband.org/page4.htm', 'http://www.stalybridgeoldband.org/page10.htm', 'http://www.stalybridgeoldband.org/page6.htm', 'http://www.stalybridgeoldband.org/index.htm', 'http://www.stalybridgeoldband.org/page3.htm', 'http://www.stalybridgeoldband.org/page8.htm', 'http://www.stalybridgeoldband.org/page2.htm', 'http://www.stalybridgeoldband.org/page11.htm', 'http://www.stalybridgeoldband.org/page7.htm', 'http://www.stalybridgeoldband.org/page9.htm', 'http://www.ennisbrassband.com/Forum_Topics.aspx', 'http://www.ennisbrassband.com/News_View.aspx', 'http://www.ennisbrassband.com/events_calendar.aspx', 'http://www.ennisbrassband.com/library_List.aspx', 'http://www.ennisbrassband.com/Default.aspx', 'http://www.ennisbrassband.com/contact.aspx', 'http://www.ennisbrassband.com/Forum_Thread.aspx', 'http://www.ennisbrassband.com/AvatarImagefetch.ashx', 'http://www.ennisbrassband.com/news_list.aspx', 'http://www.ennisbrassband.com/forums.css', 'http://www.ennisbrassband.com/Member_Register.aspx', 'http://www.ennisbrassband.com/clubsite.css', 'http://www.ennisbrassband.com/photoalbum_list.aspx', 'http://www.ennisbrassband.com/default.aspx', ) { print $req . "\n"; context( HTTP::Request-> new(GET => $req), async_dns => 1, keep_alive => 1, proxy => [ '192.168.1.1', '3128' ], ); http_request { my $res = shift; if(ref($res) and ref($res) eq 'HTTP::Response') { print length($res-> content), " bytes\n"; } else { print "error :$res\n"; } } }; }-> wait;
Subject: lambda2
Download lambda2
application/octet-stream 3.5k

Message body not shown because it is not plain text.

I've reproduced the problem and made a small patch for it. However, the example code you've sent revealed another problem, for which I too made a patch. Would it be possible to try it and see if it also solved the first bug you've reported, because I can't reproduce it? /dk
Download patch
application/octet-stream 2.2k

Message body not shown because it is not plain text.

Thanks, but I couldn't get the patch to apply: njh@packard:~/tmp/lambda/IO-Lambda-1.11$ patch -p0 < $HOME/patch patching file lib/IO/Lambda.pm Hunk #1 FAILED at 1230. Hunk #2 FAILED at 2246. 2 out of 2 hunks FAILED -- saving rejects to file lib/IO/Lambda.pm.rej patching file lib/IO/Lambda/HTTP.pm Hunk #1 FAILED at 90. Hunk #2 FAILED at 458. patch unexpectedly ends in middle of line 2 out of 2 hunks FAILED -- saving rejects to file lib/IO/Lambda/HTTP.pm.rej patch unexpectedly ends in middle of line njh@packard:~/tmp/lambda/IO-Lambda-1.11$ cat $HOME/patch Index: lib/IO/Lambda.pm =================================================================== RCS file: /home/dk/cvs/public/perl/IO-Lambda/lib/IO/Lambda.pm,v retrieving revision 1.170 diff -u -r1.170 Lambda.pm --- lib/IO/Lambda.pm 2 Jul 2009 11:34:12 -0000 1.170 +++ lib/IO/Lambda.pm 30 Jul 2009 18:11:04 -0000 @@ -1230,7 +1230,8 @@ return $match if $match; my ($maxbytes, $bufsize); - $maxbytes = $cond if defined($cond) and not ref($cond) and $cond > 0; + $maxbytes = $cond - length($$buf) + if defined($cond) and not ref($cond) and $cond > length($$buf); $bufsize = defined($maxbytes) ? $maxbytes : 65536; my $savepos = pos($$buf); # useful when $cond is a regexp @@ -2245,7 +2246,7 @@ =item integer -The lambda will succeed when exactly C<$cond> bytes are read from C<$fh>. +The lambda will succeed when C<$buf> is exactly C<$cond> bytes long. =item regexp Index: lib/IO/Lambda/HTTP.pm =================================================================== RCS file: /home/dk/cvs/public/perl/IO-Lambda/lib/IO/Lambda/HTTP.pm,v retrieving revision 1.47 diff -u -r1.47 HTTP.pm --- lib/IO/Lambda/HTTP.pm 18 Jun 2009 08:08:52 -0000 1.47 +++ lib/IO/Lambda/HTTP.pm 30 Jul 2009 18:11:06 -0000 @@ -90,8 +90,13 @@ $was_failed_auth = 0; return 'too many redirects' if ++$was_redirected > $self-> {max_redirect}; - - $req-> uri( $response-> header('Location')); + + my $uri = URI-> new($response-> header('Location')); + $uri-> scheme( $req-> uri-> scheme) + unless defined $uri-> scheme; + $uri-> host( $req-> uri-> host) + unless defined $uri-> host; + $req-> uri($uri); $req-> headers-> header( Host => $req-> uri-> host); warn "redirect to " . $req-> uri . "\n" if $DEBUG; @@ -453,18 +458,19 @@ my $size = hex $line; warn "reading chunk $size bytes\n" if $DEBUG; return 1 unless $size; + $size += 2; # CRLF # save this lambda frame @frame = restartable; # read the chunk itself - context $self-> http_read( $size); + context $self-> http_read( $offset + $size); state chunk => tail { unless ( shift ) { undef @frame; # break circular reference return undef, shift; } - $offset += $size + 2; # 2 for CRLF + $offset += $size; pos( $self-> {buf} ) = $offset; warn "chunk $size bytes ok\n" if $DEBUG; context @ctx; ]����ݵ4===njh@packard:~/tmp/lambda/IO-Lambda-1.11$
On Fri Jul 31 05:42:32 2009, njh@bandsman.co.uk wrote: Show quoted text
> Thanks, but I couldn't get the patch to apply:
I decided to apply the patch by hand, I no longer get the error, thanks. t/08_http.t took a long time to run, I almost thought I'd hung, but eventually it worked. Is that to be expected?
P.S. This has not fixed 48292, I still get that.
I can't reproduce t/08_http.t taking long time, but I'll keep an eye on it. Otherwise, is the problem solved? Should I close the ticket then?
When do you plan to publish 1.12?