ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/eg/lwp
(Generate patch)

Comparing Coro/eg/lwp (file contents):
Revision 1.1 by root, Fri Jul 27 02:51:33 2001 UTC vs.
Revision 1.3 by root, Mon Sep 3 02:50:18 2001 UTC

1#!/usr/bin/perl 1#!/usr/bin/perl
2 2
3# this hack shows how one can overwrite 3# this hack shows how one can overwrite IO::Socket::INET to provide
4# IO::Socket::INET to provide non-blocking sockets by default. 4# non-blocking sockets by default. This makes lwp magically
5# this makes lwp magically non-blocking. I hope. 5# non-blocking. I hope.
6 6
7{ 7{
8 # this is all the required magic: we replace the constructor. 8 # this is all the required magic: we replace the constructor.
9 use Coro::Socket; 9 use Coro::Socket;
10 use IO::Socket::INET; 10 use IO::Socket::INET;
14} 14}
15 15
16use Coro; 16use Coro;
17use Coro::Event; 17use Coro::Event;
18use LWP::Simple; 18use LWP::Simple;
19
20$SIG{PIPE} = 'IGNORE';
19 21
20async { 22async {
21 print "hi\n"; 23 print "hi\n";
22 get "http://localhost/"; 24 get "http://localhost/";
23 print "ho\n"; 25 print "ho\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines