CGI::Parse::PSGI(3p)

NAME
CGI::Parse::PSGI - Parses CGI output and creates PSGI response out of it

DESCRIPTION
  use CGI::Parse::PSGI qw(parse_cgi_output);

  my $output = YourApp->run;
  my $psgi_res = parse_cgi_output(\$output);

An option hash can also be passed:

  my $psgi_res = parse_cgi_output(\$output, \%options);

SYNOPSIS
CGI::Parse::PSGI exports one function "parse_cgi_output" that takes a filehandle or a reference to a string to read a CGI script output, and creates a PSGI response (an array reference containing status code, headers and a body) by reading the output.

Use CGI::Emulate::PSGI if you have a CGI code not the output, which takes care of automatically parsing the output, using this module, from your callback code.

OPTIONS
As mentioned above, "parse_cgi_output" can accept an options hash as the second argument.

Currently the options available are:

"ignore_status_line"
    A boolean value, defaulting to 0 (false). If true, the status in the HTTP protocol line is not used to set the default status in absence of a status header.

The options can be supplied to earlier versions, and will be ignored without error. Hence you can preserve legacy behaviour like this:

    parse_cgi_output(\$output, {ignore_status_line => 1});

This will ensure that if the script output includes an edge case like this:

    HTTP/1.1 666 SNAFU
    Content-Type: text/plain

    This should be OK!

then the old behaviour of ignoring the status line and returning 200 is preserved.

AUTHOR
Tatsuhiko Miyagawa

SEE ALSO
CGI::Emulate::PSGI