added test to address rt #36442
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / lib / ExternalCatty.pm
CommitLineData
6bc86362 1package ExternalCatty;
2use strict;
3use warnings;
08ff083c 4use Catalyst;
6bc86362 5
6__PACKAGE__->config( name => 'ExternalCatty' );
7__PACKAGE__->setup;
08ff083c 8__PACKAGE__->setup_engine('HTTP');
6bc86362 9
6bc86362 10# The Cat HTTP server background option is useless here :-(
11# Thus we have to provide our own background method.
12sub background {
13 my $self = shift;
14 my $port = shift;
15 my $child = fork;
16 die "Can't fork Cat HTTP server: $!" unless defined $child;
17 return $child if $child;
18
19 if ( $^O !~ /MSWin32/ ) {
20 require POSIX;
21 POSIX::setsid() or die "Can't start a new session: $!";
22 }
23
24 $self->run($port);
25}
26
271;
28