I've included an example of a test below (I can add this to the Wiki if there is interest):
use Test::More tests => 2;
use Test::WWW::Mechanize;
use strict;
use warnings;
# Setup a server to run the CGI::App Application
my $server=CGIAppServer->new;
my $pid=$server->background;
ok($pid,'HTTP Server Started');
# If something goes wrong, make sure to stop the HTTP server.
sub cleanup { kill(9,$pid) }
$SIG{__DIE__}=\&cleanup;
# Begin Testing.
my $mech=Test::WWW::Mechanize->new;
$mech->get_ok('http://localhost:8080/','HTTP Get Index');
cleanup();
{
package CGIAppServer;
use base 'HTTP::Server::Simple::CGI';
use MyCGIApp;
sub handle_request {
my ($self, $cgi) = @_;
return MyCGIApp->new->run;
}
1;
}
---
Shawn Sorichetti
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.