Stefan Trcek > webrobot-0.81 > WWW::Webrobot::StupidHTTPD



Annotate this POD

View/Report Bugs


WWW::Webrobot::StupidHTTPD - A simple HTTP daemon for tests


 # create and start the daemon
 my $daemon = WWW::Webrobot::StupidHTTPD -> new();
 $daemon -> start($server_func, fork_daemon => 1);

 # do anything else, e.g. run a client that accesses the daemon
 $config .= "names=application=" . $daemon -> server_url() . "\n";
 my $webrobot = WWW::Webrobot -> new($config);
 my $exit = $webrobot -> run($test_plan);

 # stop the daemon
 $daemon -> stop();


Start and stop a daemon. Can fork!


$wr = WWW::Webrobot -> new( %parameters );
 debug         switch to debug mode
 timout        timout (terminate) for the daemon in seconds
$wr -> start($func, %parameters)

Start a daemon. $func is the servers job to do on any request, see t/get.t for the syntax. Parameters:

 timeout       The timout for the server
 fork_daemon   Require the daemon to be forked:
               forked:     work as client (server is forked off)
               non-forked: work as server

Returns the pid of the currently started server (only if server is forked off).

$wr -> server_url

The url where you can access the recently started daemon.

This method makes only sense iff you forked the server off.

$wr -> stop( @stop_pids )

Stop the desired daemons or all if no list is given. This is done by creating a user agent and requesting an url containing shutdown.

This method makes only sense iff you forked the server off.

syntax highlighting: