ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/lwp
Revision: 1.1
Committed: Fri Jul 27 02:51:33 2001 UTC (22 years, 10 months ago) by root
Branch: MAIN
Log Message:
*** empty log message ***

File Contents

# Content
1 #!/usr/bin/perl
2
3 # this hack shows how one can overwrite
4 # IO::Socket::INET to provide non-blocking sockets by default.
5 # this makes lwp magically non-blocking. I hope.
6
7 {
8 # this is all the required magic: we replace the constructor.
9 use Coro::Socket;
10 use IO::Socket::INET;
11 sub IO::Socket::INET::new {
12 shift; new Coro::Socket @_;
13 };
14 }
15
16 use Coro;
17 use Coro::Event;
18 use LWP::Simple;
19
20 async {
21 print "hi\n";
22 get "http://localhost/";
23 print "ho\n";
24
25 };
26
27 async {
28 print "hi2\n";
29 get "http://localhost/";
30 print "ho2\n";
31 };
32
33 loop;