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