NAME

PSGI::OR::CGI - Write a PSGI app that also runs as CGI

VERSION

$Id: CGI.pm,v 0.2 2010/09/09 07:52:02 dankogai Exp dankogai $

SYNOPSIS

#!/usr/bin/env perl
# printenv.(psgi|cgi)
use strict;
use warnings;
use Data::Dumper;
use PSGI::OR::CGI;

my $app = sub {
  my $env = shift;
  return [ 200, [ 'Content-Type' => 'text/plain' ], [ Dumper($env) ] ];
};

PSGI::OR::CGI->run($app);

EXPORT

None.

METHODS

PSGI::OR::CGI->run($app)

If CGI, prints response accordingly to PSGI. If PSGI, immediately returns $app

It checks the presense of $ENV{GATEWAY_INTERFACE} to check if the script is invoked as PSGI or CGI (or mod_perl Registry which also sets this environment variable).

AUTHOR

Dan Kogai, <dankogai+cpan at gmail.com>

BUGS

Please report any bugs or feature requests to bug-psgi-or-cgi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=PSGI-OR-CGI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc PSGI::OR::CGI

You can also look for information at:

ACKNOWLEDGEMENTS

PSGI, PLACK

LICENSE AND COPYRIGHT

Copyright 2010 Dan Kogai.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.