NAME
Apache2::Controller::Dispatch::Simple - simple dispatch mechanism for A2C
VERSION
Version 1.001.001
SYNOPSIS
<Location "/subdir">
SetHandler modperl
PerlInitHandler MyApp::Dispatch
</Location>
# lib/MyApp::Dispatch:
package MyApp::Dispatch;
use base qw(
Apache2::Controller::Dispatch::Simple
);
# return hash reference from dispatch_map()
sub dispatch_map { {
foo => 'MyApp::C::Foo',
'foo/bar' => 'MyApp::C::Foo::Bar',
} }
DESCRIPTION
Implements find_controller() for Apache2::Controller::Dispatch with a simple URI-to-controller module mapping. Your URI's are the keys of the dispatch_map()
hash in your base package, and the values are the Apache2::Controller modules to which those URI's should be dispatched.
This dispatches URI's in a case-insensitive fashion. It searches from longest known path to shortest. For a site with many controllers and paths, a trie could possibly be more efficient. Consider that implementation for another Dispatch plugin module.
METHODS
find_controller
Find the controller and method for a given URI from the data set in the dispatch class module.
SEE ALSO
Apache2::Controller::Dispatch::HashTree
AUTHOR
Mark Hedges, hedges +(a t)| formdata.biz
COPYRIGHT AND LICENSE
Copyright 2008-2010 Mark Hedges. CPAN: markle
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This software is provided as-is, with no warranty and no guarantee of fitness for any particular purpose.