in reply to Forking with a socket
For something similar (but not quite easily adapted to other cases, as the server used is too simple) take a look at Test::HTTP::LocalServer, which I use for end-to-end tests of WWW::Mechanize::Shell.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
|
|---|