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

Comparing Coro/eg/lwp (file contents):
Revision 1.4 by root, Sun Nov 5 02:01:24 2006 UTC vs.
Revision 1.5 by root, Sun Nov 5 02:18:06 2006 UTC

1#!/usr/bin/perl 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 2
18use Coro; 3use Coro;
19use Coro::Event; 4use Coro::Event;
5use Coro::LWP; # should be use'd as early as possible
20use LWP::Simple; 6use LWP::Simple;
21 7
22$SIG{PIPE} = 'IGNORE'; 8$SIG{PIPE} = 'IGNORE';
23 9
24async { 10async {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines