1HTTP::Message::PSGI(3)User Contributed Perl DocumentationHTTP::Message::PSGI(3)
2
3
4

NAME

6       HTTP::Message::PSGI - Converts HTTP::Request and HTTP::Response from/to
7       PSGI env and response
8

SYNOPSIS

10         use HTTP::Message::PSGI;
11
12         # $req is HTTP::Request, $res is HTTP::Response
13         my $env = req_to_psgi($req);
14         my $res = res_from_psgi([ $status, $headers, $body ]);
15
16         # Adds methods to HTTP::Request/Response class as well
17         my $env = $req->to_psgi;
18         my $res = HTTP::Response->from_psgi([ $status, $headers, $body ]);
19

DESCRIPTION

21       HTTP::Message::PSGI gives you convenient methods to convert an
22       HTTP::Request object to a PSGI env hash and convert a PSGI response
23       arrayref to a HTTP::Response object.
24
25       If you want the other way around, see Plack::Request and
26       Plack::Response.
27

METHODS

29       req_to_psgi
30             my $env = req_to_psgi($req [, $key => $val ... ]);
31
32           Converts a HTTP::Request object into a PSGI env hash reference.
33
34       HTTP::Request::to_psgi
35             my $env = $req->to_psgi;
36
37           Same as "req_to_psgi" but an instance method in HTTP::Request.
38
39       res_from_psgi
40             my $res = res_from_psgi([ $status, $headers, $body ]);
41
42           Creates a HTTP::Response object from a PSGI response array ref.
43
44       HTTP::Response->from_psgi
45             my $res = HTTP::Response->from_psgi([ $status, $headers, $body ]);
46
47           Same as "res_from_psgi", but is a class method in HTTP::Response.
48

AUTHOR

50       Tatsuhiko Miyagawa
51

SEE ALSO

53       HTTP::Request::AsCGI HTTP::Message Plack::Test
54
55
56
57perl v5.34.0                      2021-07-22            HTTP::Message::PSGI(3)
Impressum