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!
debug switch to debug mode timout timout (terminate) for the daemon in seconds
Start a daemon. $func is the servers job to do on any request, see t/get.t for the syntax. Parameters:
$func
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).
pid
The url where you can access the recently started daemon.
This method makes only sense iff you forked the server off.
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.
shutdown
To install WWW::Webrobot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Webrobot
CPAN shell
perl -MCPAN -e shell install WWW::Webrobot
For more information on module installation, please visit the detailed CPAN module installation guide.