Skip to content

Instantly share code, notes, and snippets.

@mxey
Created February 27, 2010 22:32
Show Gist options
  • Save mxey/317017 to your computer and use it in GitHub Desktop.
Save mxey/317017 to your computer and use it in GitHub Desktop.
use common::sense;
use AnyEvent::HTTP;
use Coro;
use Coro::Channel;
use Data::Dumper;
my $q = Coro::Channel->new();
async {
http_get('http://www.chaosdorf.de',
on_header => sub {
my($hdr) = @_;
$q->put($hdr);
return 1;
},
on_body => sub {
my($partial) = @_;
$q->put($partial);
return 1
},
sub {
$q->put('done');
},
);
};
my $hdr = $q->get();
print Dumper($hdr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment