package Apache2::ASP::TransHandler; use strict; use APR::Table (); use Apache2::RequestRec (); use Apache2::RequestUtil (); use Apache2::SubRequest (); use Apache2::Const -compile => ':common'; use Apache2::ServerRec (); #============================================================================== sub handler : method { my ($class, $r) = @_; $ENV{DOCUMENT_ROOT} ||= $r->document_root; return -1; }# end handler() 1;# return true: =pod =head1 NAME Apache2::ASP::TransHandler - PerlTransHandler with access to Apache2::ASP::Config =head1 SYNOPSIS package My::TransHandler; use strict; use warnings 'all'; use base 'Apache2::ASP::TransHandler'; use Apache2::ASP::ConfigLoader; sub handler : method { my ($class, $r) = @_; my $super_response = $class->SUPER::handler( $r ); my $config = Apache2::ASP::ConfigLoader->load(); # Do stuff... calculate_pi_to_the_billionth_decimal_place(); # Finally... return $super_response; } 1;# return true: Then, in your httpd.conf: push @INC, '/path/to/your/libs'; ... PerlTransHandler My::TransHandler ... =head1 DESCRIPTION C is =head2 RequestFilters vs TransHandlers The difference between TransHandlers and Ls is that within a RequestFilter, you have access to all of the normal ASP objects ($Request, $Response, $Session, etc). In a TransHandler, you only have access to the L C<$r> and the L (and only then if you load it up yourself via L. B: - TransHandlers are configured in the C and are only executed in a real Apache2 httpd environment. They are not executed during testing or via L. TransHandlers are a handy way of jumping into "normal" mod_perl handler mode without losing access to your web application's config. =head1 BUGS It's possible that some bugs have found their way into this release. Use RT L to submit bug reports. =head1 HOMEPAGE Please visit the Apache2::ASP homepage at L to see examples of Apache2::ASP in action. =head1 AUTHOR John Drago =head1 COPYRIGHT AND LICENSE Copyright 2007 John Drago, All rights reserved. This software is free software. It may be used and distributed under the same terms as Perl itself. =cut