The uploaded file
CGI-Application-Dispatch-2.00.tar.gz
has entered CPAN as
file: $CPAN/authors/id/W/WO/WONKO/CGI-Application-Dispatch-2.00.tar.gz
size: 17444 bytes
md5: 6ac2ba70ede0d7d6e1f0ed83fe00da02
This is the official 2.00 release and fixes bugs that were caught by our
great testers of the RCs. This does not add any new features that were
discussed at YAPC (like application modules adding to the dispatch table).
NAME
CGI::Application::Dispatch - Dispatch requests to CGI::Application based
objects
SYNOPSIS
Out of Box
Under mod_perl
<Location /app>
SetHandler perl-script
PerlHandler CGI::Application::Dispatch
</Location>
Under normal cgi
#!/usr/bin/perl
use strict;
use CGI::Application::Dispatch;
CGI::Application::Dispatch->dispatch();
With a dispatch table
package MyApp::Dispatch;
use base 'CGI::Application::Dispatch';
sub dispatch_args {
return {
prefix => 'MyApp',
table => [
'' => { app => 'Welcome', rm => 'start' },
:app/:rm' => { },
'admin/:app/:rm' => { prefix => 'MyApp::Admin' },
],
};
}
Under mod_perl
<Location /app>
SetHandler perl-script
PerlHandler MyApp::Dispatch
</Location>
Under normal cgi
#!/usr/bin/perl
use strict;
use MyApp::Dispatch;
MyApp::Dispatch->dispatch();
DESCRIPTION
This module provides a way (as a mod_perl handler or running under
vanilla CGI) to look at the path ("$r->path_info" or $ENV{PATH_INFO}) of
the incoming request, parse off the desired module and it's run mode,
create an instance of that module and run it.
It currently supports both generations of mod_perl (1.x and 2.x).
Although, for simplicity, all examples involving Apache configuration
and mod_perl code will be shown using mod_perl 1.x. This may change as
mp2 usage increases.
It will translate a URI like this (under mod_perl):
/app/module_name/run_mode
or this (vanilla cgi)
/app/index.cgi/module_name/run_mode
into something that will be functionally similar to this
my $app = Module::Name->new(..);
$app->mode_param(sub {'run_mode'}); #this will set the run mode
--
Michael Peters
Developer
Plus Three, LP
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]