Unable to run sample code of AnyEvent::HTTP

Mons Anderson mons at cpan.org
Mon Jul 12 08:36:51 CEST 2010


You forgot AE::cv->recv;

#!/usr/bin/perl

use common::sense;
use AnyEvent;
use AnyEvent::HTTP;
my $cv = AE::cv;
http_get "http://www.example.com", sub { print $_[1]; $cv->send; };
$cv->recv;

just read AnyEvent::Intro.

On Mon, Jul 12, 2010 at 6:28 AM, Ryan Chan <ryanchan404 at gmail.com> wrote:
> A sample code (according to
> http://search.cpan.org/dist/AnyEvent-HTTP/HTTP.pm)  cannot run in
> Ubuntu 9.04/CPAN install of AnyEvent::HTTP:
>
> e.g.
>
> perl -w -e 'use AnyEvent::HTTP; print $AnyEvent::HTTP::VERSION';
>
> 1.45
>
> #================
>
> #!/usr/bin/perl -w
>
> use strict;
> use warnings;
>
> use AnyEvent::HTTP;
>
> http_get "http://www.example.com", sub { print $_[1] };
> #================
>
> Nothing got print out.
>
> Any idea?
>
> _______________________________________________
> anyevent mailing list
> anyevent at lists.schmorp.de
> http://lists.schmorp.de/mailman/listinfo/anyevent
>



-- 
Best wishes,
Vladimir V. Perepelitsa aka Mons Anderson
<inthrax at gmail.com>, <mons at cpan.org>
http://github.com/Mons



More information about the anyevent mailing list