I usually fake a query object (using Test::MockObject and reusing some setup I did in a script before :-)), and then run the tests against the query object and my CGI::Application subclass. There I can easily collect the output via the run method:
my $output = $app->run(@params);
is( $output, $expected, $name );
# and so on ...
This is not necessarily a full end-to-end test though, as this might miss some of the headers, but I found it good enough for my needs.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The
$d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider
($c = $d->accept())->get_request(); $c->send_response( new #in the
HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
|