| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use Coro::LWP; # should be use'd as early as possible |
| 4 |
|
| 5 |
use Coro; |
| 6 |
use Coro::AnyEvent; |
| 7 |
use LWP::Simple; |
| 8 |
|
| 9 |
$SIG{PIPE} = 'IGNORE'; |
| 10 |
|
| 11 |
my @pids; |
| 12 |
|
| 13 |
for (1..1) { |
| 14 |
push @pid, async { |
| 15 |
print "starting to fetch http://www.google.de/\n"; |
| 16 |
get "http://www.google.de/"; |
| 17 |
print "fetched http://www.google.de/\n"; |
| 18 |
}; |
| 19 |
|
| 20 |
push @pid, async { |
| 21 |
print "starting to fetch http://www.yahoo.com/\n"; |
| 22 |
get "http://www.yahoo.com/"; |
| 23 |
print "fetched http://www.yahoo.com/\n"; |
| 24 |
}; |
| 25 |
} |
| 26 |
|
| 27 |
$_->join for @pid; |
| 28 |
|