Apache2-Controller
view release on metacpan or search on metacpan
lib/Apache2/Controller.pm view on Meta::CPAN
all site modules for every page handler, which could help with load-balancing
highly optimized handlers for specific URI's while having a universal
application installer.
Picture if you will, a programming utopia in which all engineers
are respected, highly paid and content, and managers make
correct decisions to rely on open-source software.
You deploy the same Apache, the
same CPAN modules and your whole application package to every server,
and attach a url-generating subroutine to the L<Template|Template> stash
that puts in a different hostname when the URI is one of your
load-intensive functions.
<a href="[% myurl('/easy') %]">easy</a> "http://pony.x.y/easy"
<a href="[% myurl('/hard') %]">hard</a> "http://packhorse.x.y/hard"
Web designers can be taught to use this function C<< myurl() >>,
but system admins
maintain the map that it loads to figure out what servers to use.
lib/Apache2/Controller.pm view on Meta::CPAN
my $method = $pnotes_a2c->{method};
$self->{method} = $method;
$self->{path_args} = $pnotes_a2c->{path_args};
# don't instantiate the 'session' key of $self unless it's implemented
# in some earlier stage of the apache lifecycle.
my $session = $pnotes_a2c->{session};
if ($session) {
$self->{session} = $session;
DEBUG(sub{"found and attached session to controller self:\n".Dump($session)});
# this is the same reference as the pnotes reference still,
# so the cleanup handler will find all changes made to it
}
DEBUG sub { Dump({
# for simple debugging, stringify objects, otherwise this can get huge
map {($_ => defined $self->{$_} ? "$self->{$_}" : undef)} keys %$self
}) };
return $self;
lib/Apache2/Controller/Auth/OpenID.pm view on Meta::CPAN
For the internal pages (login, logout, register), if they are
relative, re-dispatch them and return OK, else if absolute,
set location and return redirect.
If where == register or login, and the current uri is not
register or login, stash the current uri in
C<< session->{a2c}{openid}{previous}{uri} >>, and if
C<< A2C_Auth_OpenID_NoPreserveParams >> is NOT set,
then it stashes the get args and post body in C<< ...{previous}{get} >>
and C<< ...{previous}{post} >> for reattaching to the request
after successful authentication on the return from the auth server.
=cut
sub redispatch {
my ($self, $where_uri) = @_;
DEBUG "redispatch uri '$where_uri'?";
# if it's an absolute path or schemed url, use a location redirect
lib/Apache2/Controller/Session.pm view on Meta::CPAN
use Digest::SHA qw( sha224_base64 );
use Apache2::Const -compile => qw( OK );
use Apache2::RequestUtil ();
use Apache2::Controller::X;
use Apache2::Controller::Const qw( $DEFAULT_SESSION_SECRET );
=head2 process
The C<process()> method
attaches or creates a session, and pushes a PerlLogHandler
closure to save the session after the end of the request.
It sets the session id cookie
with an expiration that you set in your subclass as C<our $expiration = ...>
in a format that is passed to Apache2::Cookie. (i.e. '3M', '2D', etc.)
Don't set that if you want them to expire at the end of the
browser session.
=cut
lib/Apache2/Controller/X.pm view on Meta::CPAN
myx message => q{ You're not supposed to be here. },
status => Apache2::Const::FORBIDDEN,
action => sub {"not sure how you'd implement this actually"},
dump => {
this => q{structure will get YAML::Syck::Dump'd},
that => [qw( to the error log )],
};
}
TODO: when $X is intercepted by handler() in each of the controller layers,
attach it to pnotes.
=head1 DESCRIPTION
Hierarchy of L<Exception::Class> objects for L<Apache2::Controller>.
All are subclasses of Apache2::Controller::X.
=head1 FIELDS
All Apache2::Controller::X exceptions implement three fields:
( run in 1.560 second using v1.01-cache-2.11-cpan-e1769b4cff6 )