LWP-Protocol-Coro-http
view release on metacpan or search on metacpan
inc/Test/HTTP/LocalServer.pm view on Meta::CPAN
A good idea for a slow server would be
eval => sleep+10
=back
All served HTML will have the first %s replaced by the current location.
The following entries will be removed from C<%ENV>:
HTTP_PROXY
http_proxy
CGI_HTTP_PROXY
=cut
sub spawn {
my ($class,%args) = @_;
my $self = { %args };
bless $self,$class;
local $ENV{TEST_HTTP_VERBOSE} = 1
if (delete $args{debug});
delete @ENV{qw(HTTP_PROXY http_proxy CGI_HTTP_PROXY)};
$self->{delete} = [];
if (my $html = delete $args{html}) {
# write the html to a temp file
my ($fh,$tempfile) = File::Temp::tempfile();
binmode $fh;
print $fh $html
or die "Couldn't write tempfile $tempfile : $!";
close $fh;
push @{$self->{delete}},$tempfile;
( run in 2.314 seconds using v1.01-cache-2.11-cpan-71847e10f99 )