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