File: lwp

package info (click to toggle)
libcoro-perl 6.570-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,144 kB
  • sloc: ansic: 2,560; perl: 2,122; makefile: 14
file content (28 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

use Coro::LWP; # should be use'd as early as possible

use Coro;
use Coro::AnyEvent;
use LWP::Simple;

$SIG{PIPE} = 'IGNORE';

my @pids;

for (1..1) {
   push @pid, async {
      print "starting to fetch http://www.google.de/\n";
      get "http://www.google.de/";
      print "fetched http://www.google.de/\n";
   };

   push @pid, async {
      print "starting to fetch http://www.yahoo.com/\n";
      get "http://www.yahoo.com/";
      print "fetched http://www.yahoo.com/\n";
   };
}

$_->join for @pid;