Apache2-Controller
view release on metacpan or search on metacpan
lib/Apache2/Controller/DBI/Connector.pm view on Meta::CPAN
(This used to be a PerlCleanupHandler, but it appears that Apache
hands this off to a thread even if running under prefork, and
cleanup doesn't always get processed before the child handles
the next request. At least, this is true under L<Apache::Test>.
Wacky. So, it's a PerlLogHandler to make sure the commit or
rollback gets done before the connection dies.)
If you subclass, you can set up multiple dbh handles with different params:
<Location '/busy/database/page'>
SetHandler modperl
PerlInitHandler MyApp::Dispatch
PerlHeaderParserHandler MyApp::DBI::Writer MyApp::DBI::Read
</Location>
If you use a tiered database structure with one master record
and many replicated nodes, you can do it this way. Then you
overload C<< dbi_pnotes_name >> to provide the pnotes key,
say "dbh_write" and "dbh_read". In the controller get them
lib/Apache2/Controller/Session.pm view on Meta::CPAN
Apache::Session does not always save automatically, for
example if you change something in the bottom tier of
a multi-level hash. If you want to, set the directive flag
C<A2C_Session_Always_Save> and this will set a top-level
timestamp C<< $r->pnotes->{a2c}{session}{a2c_timestamp} >>
on the way out to trigger L<Apache::Session> to save everything.
But if you are potentially accessing the session contents without
setting it every time, you should just set a top-level timestamp
manually to indicate to L<Apache::Session> that you want
things saved at the end of every request, but this may
slow you down on a busy site, so it is not the default.
See L<Apache2::Controller::Directives/A2C_Session_Always_Save>
and L<Apache::Session/BEHAVIOR>.
=head1 IMPLEMENTING TRACKER SUBCLASSES
See L<Apache2::Controller::Session::Cookie> for how to implement
a custom tracker subclass. This implements C<$sid = get_session_id()>
which gets a session id from a cookie, and C<set_session_id($sid)>
which sets the session id in the cookie.
( run in 0.236 second using v1.01-cache-2.11-cpan-87723dcf8b7 )