ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/lwp
Revision: 1.2
Committed: Sat Jul 28 01:41:58 2001 UTC (22 years, 10 months ago) by root
Branch: MAIN
Changes since 1.1: +3 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.1 #!/usr/bin/perl
2    
3 root 1.2 # this hack shows how one can overwrite IO::Socket::INET to provide
4     # non-blocking sockets by default. This makes lwp magically
5     # non-blocking. I hope.
6 root 1.1
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;