#!/usr/bin/perl # this hack shows how one can get LWP to be less blocking. { # we replace Socket::inet_aton and CORE::select use Coro::Select; # must come early use Coro::Util; use Coro::Socket; use IO::Socket::INET; use Socket; BEGIN { *Socket::inet_aton = \&Coro::Util::inet_aton; *IO::Socket::INET::new = sub { new Coro::Socket forward_class => @_ }; } } use Coro; use Coro::Event; use LWP::Simple; $SIG{PIPE} = 'IGNORE'; async { print "hi2\n"; get "http://www.google.de/"; print "ho2\n"; }; async { print "hi\n"; get "http://www.yahoo.com/"; print "ho\n"; }; loop;