Apache2::ASP::PageHandler - Handler class for *.asp scripts
# Execute the page that the $asp object is pointing at, # and pass in some args to that page: Apache2::ASP::PageHandler->run($asp, @args); if( Apache2::ASP::PageHandler->asp_has_changed( $asp_filename ) ) { ... } if( Apache2::ASP::PageHandler->asp_exists( $asp_filename ) ) { ... } if( Apache2::ASP::PageHandler->pm_exists( $pm_filename ) ) { ... } Apache2::ASP::PageHandler->compile_asp( $package_filename, $asp_filename, $pm_filename ); my $perl_module_code = Apache2::ASP::PageHandler->asp_to_package( $code, $package_name );
This class is the subclass of Apache2::ASP::Handler that processes all requests for ASP scripts.
It works by converting your ASP code into a Perl module, then loading that module up like any other Perl module.
Once loaded, your code is executed (like any other Perl module) and the result is printed to the client.
If your ASP script contains code like this:
<% $Response->Write("Hello, World!"); $Response->End; %>
You will end up with a file inside of $ENV{APACHE2_ASP_APPLICATION_ROOT}/PAGE_CACHE/[ApplicationName]/hello_world_asp.pm containing code like this:
$ENV{APACHE2_ASP_APPLICATION_ROOT}/PAGE_CACHE/[ApplicationName]/hello_world_asp.pm
#============================================================================== # THIS FILE WAS AUTOMATICALLY GENERATED BY Apache2::ASP::PageHandler. # TIMESTAMP: Wed Jun 20 23:42:53 2007 # CHANGES TO THIS FILE WILL BE OVERWRITTEN WHEN THE ASP SCRIPT IS CHANGED #============================================================================== package DefaultApp::index_asp; use strict; use warnings 'all'; no warnings 'redefine'; use base 'Apache2::ASP::PageHandler'; use vars qw( $Session $Server $Request $Response $Form $Application $Config ); #line 1 sub process_request {my $SELF = shift; $Response->Write(q~~); $Response->Write("Hello, World!"); return; ;$Response->Write(q~ ~); } 1;# return true: =pod =head2 process_request( ) =cut
Your code ends up inside of sub <process_request()> - so do not declare any subroutines in your ASP script. Doing so may end up causing a memory leak.
Executes whatever page the $asp->r->uri is pointed at.
Passes in @args to the ASP script upon execution as @_.
@args
@_
Returns true if $asp_filename was last modified after $pm_filename was.
$asp_filename
$pm_filename
Returns true if $pm_filename exists.
Returns true if $asp_filename exists.
Compiles the $asp_filename into a package named $full_package_name and writes the resulting Perl code to $pm_filename.
$full_package_name
Initializes the ASP objects in the namespace indicated by $full_package_name.
Classic ASP objects include $Session, $Server, $Application, $Request, $Response, $Form and $Config.
Places the $code into a real Perl module named $package_name, then returns the resulting Perl code.
$code
$package_name
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.
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
John Drago mailto:jdrago_999@yahoo.com
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.
To install Apache2::ASP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::ASP
CPAN shell
perl -MCPAN -e shell install Apache2::ASP
For more information on module installation, please visit the detailed CPAN module installation guide.