Test::AnyEvent::plackup - Starting HTTP server by |plackup| command for tests
use Test::AnyEvent::plackup;
$server = Test::AnyEvent::plackup->new;
$server->app('path/to/server.psgi');
$server->server('Starlet');
($start_cv, $stop_cv) = $server->start_server;
$start_cv->cb(sub {
warn "Started";
$url = 'http://localhost:' . $server->port . '/';
... get $url;
$server->stop_server;
});
$stop_cv->cb(sub {
warn "Stopped";
});
- $server->set_env(NAME => VALUE)
-
Set the environment variable with specified name and value. Any existing variable with same name is overridden. If the value is
undef
, the variable is unset.By default, the currently set environent variables (i.e.
%ENV
) are used.
The module depends on AnyEvent. In addition, it requires Net::TCP::FindPort and Parse::Netstat, both registered as Git submodules (See .gitmodules
).
Moreover, plackup
and netstat
commands are required.
Latest version of the module is available at the GitHub repository: <https://github.com/wakaba/perl-test-anyevent-plackup>.
The module is tested at Travis CI: <http://travis-ci.org/wakaba/perl-test-anyevent-plackup>.
Wakaba <[email protected]>.
Copyright 2012 Hatena <http://www.hatena.ne.jp/>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.