Apache2-DirBasedHandler

 view release on metacpan or  search on metacpan

lib/Apache2/DirBasedHandler.pm  view on Meta::CPAN

style handlers.  This module is intended to be subclassed.

A request for 

  $r->location . qq[/foo/bar/baz/]

will be served by the first of the following functions with is defined

  foo_bar_baz_page
  foo_bar_page
  foo_page
  root_index

=head1 METHODS

The following methods (aside from 'handler') are meant to be overridden in your 
subclass if you want to modify its behavoir.

=head2 handler

C<handler> is the guts of DirBasedHandler.  It provides the basic structure of the
module, turning the request uri into an array, which is then turned into possible
function calls.  

=head2 init 

C<init> is used to include objects or data you want to be passed into 
your page functions.  To be most useful it should return a hash reference. 
The default implementation returns a reference to an empty hash.

=head2 parse_uri

C<parse_uri> takes an Apache::RequestRec (or derived) object, and returns a reference to an
array of all the non-slash parts of the uri.  It strips repeated slashes in the 
same manner that they would be stripped if you do a request for static content.

=head2 uri_to_function

C<uri_to_function> converts an Apache2::RequestRec (or derived) object and an
array reference and returns and returns the name of a function to handle the
request it's arguments describe.

=head2 root_index

C<root_index> handles requests for $r->location, and any requests that have no 
other functions defined to handle them.  You must subclass it (or look silly)

=head2 set_debug

C<set_debug> enables or disables debug output to the apache error log

=head1 DEPENDENCIES

This module requires modperl 2 (http://perl.apache.org), and 
libapreq (http://httpd.apache.org/apreq/) which must be installed seperately.

=head1 INCOMPATIBILITIES

There are no known incompatibilities for this module.

=head1 BUGS AND LIMITATIONS

There are no known bugs in this module.  Please report any problems through 

http://rt.cpan.org/Public/Dist/Display.html?Name=Apache2-DirBasedHandler

=head1 AUTHOR

Adam Prime (adam.prime@utoronto.ca)

=head1 LICENSE AND COPYRIGHT

Copyright (c) 2008 by Adam Prime (adam.prime@utoronto.ca).  All rights 
reserved.  This program is free software; you can redistribute it and/or 
modify it under the same terms as Perl itself.  See L<perlartistic>.

This module is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
or FITNESS FOR A PARTICULAR PURPOSE.



( run in 1.192 second using v1.01-cache-2.11-cpan-39bf76dae61 )