NAME

Apache2::Controller::Funk

VERSION

Version 1.001.000

SYNOPSIS

$bool = controller_allows_method($class, $method); 

check_allowed_method($class, $method);     # throws NOT_FOUND exception

DESCRPTION

Useful routines for both Apache2::Controller and Apache2::Controller::Dispatch objects to run. Results and whether to 'require' are cached in this package's namespace across requests, optimizing efficiency per mod_perl2 child, and are queried futher using 'exists', which is very fast.

IMPORTABLE FUNCTIONS

controller_allows_method

$bool = controller_allows_method($class, $method); # controller_allows_method()

Ask if method name is returned by allowed_methods() in the given controller package.

Only two 'exists' calls are required for each query after caching the first result for this child.

check_allowed_method

check_allowed_method($method, $class); # check_allowed_method()

Throw a NOT_FOUND exception if the method is not an allowed method in the allowed_methods() list in the controller package.

log_bad_request_reason( )

log_bad_request_reason( $r, $X );

Call $r->log_reason( $msg, $r->uri() ) where $msg is a truncated version of $X in case $X is too long.