sub run {
my $self = shift;
- if ($ENV{PHP_FCGI_CHILDREN} || $ENV{FCGI_ROLE} || $ENV{FCGI_SOCKET_PATH}) {
+ if (
+ $ENV{PHP_FCGI_CHILDREN} || $ENV{FCGI_ROLE} || $ENV{FCGI_SOCKET_PATH}
+ || -S STDIN # STDIN is a socket, almost certainly FastCGI
+ ) {
return $self->_run_fcgi;
} elsif ($ENV{GATEWAY_INTERFACE}) {
return $self->_run_cgi;
Plack::Test::test_psgi(
$self->to_psgi_app, sub { $response = shift->($request) }
);
- print $response->as_string;
+ print STDERR $response->status_line."\n";
+ print STDERR $response->headers_as_string("\n")."\n";
+ my $content = $response->content;
+ $content .= "\n" if length($content) and $content !~ /\n\z/;
+ print STDOUT $content if $content;
}
sub _run_cli {
my $c = HTTP::Request::AsCGI->new(@args)->setup;
$app->run;
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S. Trout <mst@shadowcat.co.uk>
+See L<Web::Simple> for authors.
-=head1 CONTRIBUTORS
+=head1 COPYRIGHT AND LICENSE
-None required yet. Maybe this module is perfect (hahahahaha ...).
-
-=head1 COPYRIGHT
-
-Copyright (c) 2010 the Web::Simple L</AUTHOR> and L</CONTRIBUTORS>
-as listed above.
-
-=head1 LICENSE
-
-This library is free software and may be distributed under the same terms
-as perl itself.
+See L<Web::Simple> for the copyright and license.
=cut