Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Modern::Perl; use AnyEvent; my @users = ( 1 ); while ( @users ) { my $user_id = shift @users; my ( $info_1, $info_2, $info_3 ); my $cv = AnyEvent->condvar; # get the first user info $cv->begin; say "request 1"; $info_1 = "x"; sleep 10; $cv->end; # get the second user info $cv->begin; say "request 2"; $info_2 = "x"; sleep 10; $cv->end; # get the second user info $cv->begin; say "request 3"; $info_3 = "x"; sleep 10; $cv->end; # merge pont $cv->recv; say "$user_id: $info_1, $info_2, $info_3"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AnyEvent Parallel HTTP
by Yary (Pilgrim) on Feb 19, 2015 at 20:00 UTC | |
by Corion (Patriarch) on Feb 21, 2015 at 16:46 UTC | |
|
Re: AnyEvent Parallel HTTP
by Corion (Patriarch) on Feb 21, 2015 at 16:48 UTC |