The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache2::Controller::Methods - methods shared by Apache2::Controller modules

VERSION

Version 1.001.000

SYNOPSIS

 package Apache2::Controller::SomeNewBrilliantPlugin;

 use base qw( Apache2::Controller::Methods );

 # ...
 my $directives = $self->get_directives();
 my $directive  = $self->get_directive('A2CSomethingSomething');

DESCRIPTION

Methods shared in common by various Apache2::Controller modules, like Apache2::Controller, Apache2::Controller::Dispatch, etc.

Note: In this module we always dereference $self-{r}>, because we don't know if $self is blessed as an Apache2::Request yet or not. (This package is used as a base by multiple handler stages.)

METHODS

get_directives

 my $directives_hashref = $self->get_directives();

Returns the Apache2::Controller::Directives config hash for this request, with per-directory settings.

NOTE: real directives don't work because of problems with Apache::Test. For now use PerlSetVar.

When directives work, if you mix A2C Directives with PerlSetVar statements in Apache config, the directives take precedence and the PerlSetVar values are not merged. Hrmm. Well, I think there's a method, but I've got better things to work on right now.

get_directive

 my $value = $self->get_directive( $A2CDirectiveNameString )

Returns the value of the given directive name. Does not die if get_directives() returns an empty hash.

NOTE: directives don't work because of problems with Apache::Test. For now use PerlSetVar.

 my $jar = $self->get_cookie_jar();

Gets the Apache2::Cookie::Jar object.

Does NOT cache the jar in any way, as this is the business of Apache2::Cookie, and input headers could possibly change via filters, and it would create a circular reference to $r if you stuck it in pnotes. It always creates a new Jar object, which acts as a utility object to parse the source information that remains in $r, if I understand this correctly.

If the directive << A2C_Skip_Bogus_Cookies >> is set, fetches jar in eval and returns $EVAL_ERROR->jar if the error is an APR::Request::Error and the code is APR::Request::Error::NOTOKEN, indicating a cookie with a value like '1' sent by a defective client. Any other APR::Error will be re-thrown as per that doc, otherwise A2C will throw an Apache2::Controller::X with the error. (See http://comments.gmane.org/gmane.comp.apache.apreq/4477 - closes RT #61744, thanks Arkadius Litwinczuk.) Skipping these errors is optional since they might be important for debugging clients that send invalid headers.

See Apache2::Cookie, Apache2::Controller::Directives.

SEE ALSO

Apache2::Controller

Apache2::Controller::Session

Apache2::Request

Apache2::Module

Apache2::Directives

Apache2::Cookie

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.