# this is the test server that does a tricke feed response #!/usr/bin/perl use IO::Socket; use IO::Select; $lsn = IO::Socket::INET->new( Listen => 1, LocalAddr => 'localhost', LocalPort => 9000,); my $client = new IO::Select( $lsn ); while( my @ready = $client->can_read ) { for my $fh (@ready) { if($fh == $lsn) { warn "Accepted new socket\n"; my $new = $lsn->accept; $client->add($new); } else { # Process socket warn "Getting data\n"; $data = <$fh>; # yeah yeah this is only a toy app warn "Got $data\nDoing stuff slowly!\n"; my @response = split '', "HTTP/1.1 200 OK\n\nHello World!\n"; for( @response) { warn $_; sleep 1; print {$fh} $_; } $client->remove($fh); $fh->close(); } } } # this is the test client #!/usr/bin/perl use LWP::UserAgent; use Data::Dumper; my $ua = LWP::UserAgent->new( timeout => 2 ); $response = $ua->get('http://localhost:9000/'); print Dumper $response;