John Drago > Apache2-ASP-2.46 > Apache2::ASP::TransHandler

Download:
Apache2-ASP-2.46.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  2
View/Report Bugs
Source  

NAME ^

Apache2::ASP::TransHandler - PerlTransHandler with access to Apache2::ASP::Config

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:

  <Perl>
    push @INC, '/path/to/your/libs';
  </Perl>

  <VirtualHost *:80>
    ...
    PerlTransHandler My::TransHandler
    ...
  </VirtualHost>

DESCRIPTION ^

Apache2::ASP::TransHandler is

RequestFilters vs TransHandlers

The difference between TransHandlers and Apache2::ASP::RequestFilters 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 Apache2::RequestRec $r and the Apache2::ASP::Config (and only then if you load it up yourself via Apache2::ASP::ConfigLoader.

NOTE: - TransHandlers are configured in the httpd.conf and are only executed in a real Apache2 httpd environment. They are not executed during testing or via Apache2::ASP::API.

TransHandlers are a handy way of jumping into "normal" mod_perl handler mode without losing access to your web application's config.

BUGS ^

It's possible that some bugs have found their way into this release.

Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.

HOMEPAGE ^

Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.

AUTHOR ^

John Drago <jdrago_999@yahoo.com>

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.

syntax highlighting: