Test::HTTP::LocalServer->spawn %ARGS

This spawns a new HTTP server. The server will stay running until $server->stop is called.

Valid arguments are:

  • html

    scalar containing the page to be served

  • file

    filename containing the page to be served

  • debug

    Set to true to make the spawned server output debug information

All served HTML will have the first %s replaced by the current location.

$server->port

This returns the port of the current server. As new instances will most likely run under a different port, this is convenient if you need to compare results from two runs.

$server->url

This returns the url where you can contact the server. This url is valid until you call $server->stop or $server->get_output

$server->stop

This stops the server process by requesting a special url.

$server->get_output

This stops the server by calling stop and then returns the output of the server process. This output will be a list of all requests made to the server concatenated together as a string.

EXPORT

None by default.

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Copyright (C) 2003 Max Maischein

AUTHOR

Max Maischein, <corion@cpan.org>

Please contact me if you find bugs or otherwise improve the module. More tests are also very welcome !

SEE ALSO

WWW::Mechanize,WWW::Mechanize::Shell