1CGI::Parse::PSGI(3) User Contributed Perl Documentation CGI::Parse::PSGI(3)
2
3
4
6 CGI::Parse::PSGI - Parses CGI output and creates PSGI response out of
7 it
8
10 use CGI::Parse::PSGI qw(parse_cgi_output);
11
12 my $output = YourApp->run;
13 my $psgi_res = parse_cgi_output(\$output);
14
15 An option hash can also be passed:
16
17 my $psgi_res = parse_cgi_output(\$output, \%options);
18
20 CGI::Parse::PSGI exports one function "parse_cgi_output" that takes a
21 filehandle or a reference to a string to read a CGI script output, and
22 creates a PSGI response (an array reference containing status code,
23 headers and a body) by reading the output.
24
25 Use CGI::Emulate::PSGI if you have a CGI code not the output, which
26 takes care of automatically parsing the output, using this module, from
27 your callback code.
28
30 As mentioned above, "parse_cgi_output" can accept an options hash as
31 the second argument.
32
33 Currently the options available are:
34
35 "ignore_status_line"
36 A boolean value, defaulting to 0 (false). If true, the status in
37 the HTTP protocol line is not used to set the default status in
38 absence of a status header.
39
40 The options can be supplied to earlier versions, and will be ignored
41 without error. Hence you can preserve legacy behaviour like this:
42
43 parse_cgi_output(\$output, {ignore_status_line => 1});
44
45 This will ensure that if the script output includes an edge case like
46 this:
47
48 HTTP/1.1 666 SNAFU
49 Content-Type: text/plain
50
51 This should be OK!
52
53 then the old behaviour of ignoring the status line and returning 200 is
54 preserved.
55
57 Tatsuhiko Miyagawa
58
60 CGI::Emulate::PSGI
61
62
63
64perl v5.30.1 2020-01-29 CGI::Parse::PSGI(3)