NAME
Catalyst::Controller::CGIBin - Serve CGIs from root/cgi-bin
VERSION
Version 0.002
SYNOPSIS
In your controller:
package MyApp::Controller::Foo;
use parent qw/Catalyst::Controller::CGIBin/;
# example of a forward to /cgi-bin/hlagh/mtfnpy.cgi
sub dongs : Local Args(0) {
my ($self, $c) = @_;
$c->forward($self->cgi_action('hlagh/mtfnpy.cgi'));
}
In your .conf:
<Controller::Foo>
<CGI>
username_field username # used for REMOTE_USER env var
pass_env PERL5LIB
pass_env PATH
pass_env /^MYAPP_/
</CGI>
</Controller::Foo>
DESCRIPTION
Dispatches to CGI files in root/cgi-bin for /cgi-bin/ paths.
Unlike ModPerl::Registry this module does _NOT_ stat and recompile the CGI for every invocation. If this is something you need, let me know.
CGI paths are converted into action names using cgi_action (below.)
A path such as root/cgi-bin/hlagh/bar.cgi
will get the private path foo/CGI_hlagh_bar_cgi
, for controller Foo, with the /
s converted to _
s and prepended with CGI_
, as well as all non-word characters converted to _
s. This is because Catalyst action names can't have non-word characters in them.
Inherits from Catalyst::Controller::WrapCGI, see the documentation for that module for configuration information.
METHODS
$self->cgi_action($cgi_path)
Takes a path to a CGI from root/cgi-bin
such as foo/bar.cgi
and returns the action name it is registered as. See "DESCRIPTION" for a discussion on how CGI actions are named.
$self->is_perl_cgi($path)
Tries to figure out whether the CGI is Perl or not.
If it's Perl, it will be inlined into a sub instead of being forked off, see wrap_perl_cgi (below.)
If it's not doing what you expect, you might want to override it, and let me know as well!
$self->wrap_perl_cgi($path)
Takes the path to a Perl CGI and returns a coderef suitable for passing to cgi_to_response (from Catalyst::Controller::WrapCGI.)
By default returns:
eval 'sub {' . slurp($path) . '}'
This is similar to how ModPerl::Registry works, but will only work for well-written CGIs. Otherwise, you may have to override this method to do something more involved (see ModPerl::PerlRun.)
$self->wrap_nonperl_cgi($path)
Takes the path to a non-Perl CGI and returns a coderef for executing it.
By default returns:
sub { system $path }
SEE ALSO
Catalyst::Controller::WrapCGI, CatalystX::GlobalContext, Catalyst::Controller, CGI, Catalyst
AUTHOR
Rafael Kitover, <rkitover at cpan.org>
BUGS
Please report any bugs or feature requests to bug-catalyst-controller-wrapcgi at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Controller-WrapCGI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
More information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Controller-WrapCGI
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT & LICENSE
Copyright (c) 2008 Rafael Kitover
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.