NAME
CGI::PSGI - Enable your CGI.pm aware applications to adapt PSGI protocol
SYNOPSIS
use CGI::PSGI;
sub app {
my $env = shift;
my $q = CGI::PSGI->new($env);
return [ $q->psgi_header, [ $body ] ];
}
DESCRIPTION
First of all, if you have a CGI script that you want to run under PSGI web servers (i.e. "end users" of CGI.pm), this module might not be what you want. Take a look at CGI::Emulate::PSGI instead.
This module is for web application framework developers who currently uses CGI to handle query parameters. You can switch to use CGI::PSGI instead of CGI, to make your framework compatible to PSGI with a slight modification of your framework adapter.
Your application, typically the web application framework adapter should update the code to do CGI::PSGI->new($env)
instead of CGI->new
to create a new CGI object, in the same way how CGI::Fast object is being initialized in FastCGI environment.
CGI::PSGI is a subclass of CGI and handles the difference between CGI and PSGI environments transparently for you. Function-based interface like use CGI ':standard'
doesn't work with this module. You should always create an object with CGI::PSGI->new($env)
and should call a method on it.
psgi_header
method is added for your convenience if your application uses $cgi->header
to generate header, but you are free to ignore this method and instead can generate status code and headers array ref by yourself.
AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.