ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/lwp
Revision: 1.4
Committed: Sun Nov 5 02:01:24 2006 UTC (17 years, 7 months ago) by root
Branch: MAIN
Changes since 1.3: +17 -14 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/usr/bin/perl
2
3 # this hack shows how one can get LWP to be less blocking.
4
5 {
6 # we replace Socket::inet_aton and CORE::select
7 use Coro::Select; # must come early
8 use Coro::Util;
9 use Coro::Socket;
10 use IO::Socket::INET;
11 use Socket;
12 BEGIN {
13 *Socket::inet_aton = \&Coro::Util::inet_aton;
14 *IO::Socket::INET::new = sub { new Coro::Socket forward_class => @_ };
15 }
16 }
17
18 use Coro;
19 use Coro::Event;
20 use LWP::Simple;
21
22 $SIG{PIPE} = 'IGNORE';
23
24 async {
25 print "hi2\n";
26 get "http://www.google.de/";
27 print "ho2\n";
28 };
29
30 async {
31 print "hi\n";
32 get "http://www.yahoo.com/";
33 print "ho\n";
34
35 };
36
37 loop;
38