NAME
Apache2::DirBasedHandler - Directory based Location Handler helper
VERSION
version 0.01
SYNOPSIS
package My::Thingy
use strict use Apache2::DirBasedHandler our @ISA =
qw(Apache2::DirBasedHandler); use Apache2::Const -compile =>
qw(:common);
sub index { my $self = shift; my ($r,$uri_args,$args) = @_;
if (@$uri_args) {
return Apache2::Const::NOT_FOUND;
}
return (
Apache2::Const::OK,
qq[this is the index],
qq[text/plain; charset=utf-8]
);
}
sub super_page { my $self = shift; my ($r,$uri_args,$args) = @_;
return (
Apache2::Const::OK,
qq[this is $location/super and all it's contents],
qq[text/plain; charset=utf-8]
);
}
sub super_dooper_page { my $self = shift; my ($r,$uri_args,$args) = @_;
return (
Apache2::Const::OK,
qq[this is $location/super/dooper and all it's contents],
qq[text/plain; charset=utf-8]
);
}
1;
DESCRIPTION
This module is designed to allow people to more quickly implement uri to
function style handlers
handler
the uri is cut up into bits, then the first argument is used to
determine what page the user is after, so a function is called based on
that argument. The rest of the uri, the request object, and all our
template crap are then passed into that function. If there is no uri, a
base function called index_page is called (which you really want to
subclass)
init
The init function is used to stuff other things into the page function
calls. it should probably return a hash reference to be the most useful.
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
index
index is the function called when someone requests the absolute root of
the location you are talking about