Apache2::ASP::Handler - Base class for all Apache2::ASP handlers
package MyHandler; use strict; use base 'Apache2::ASP::Handler'; sub run { my ($s, $asp, @args) = @_; $asp->response->Write("Hello, world!."); }# end process_request() 1;# return true:
Access MyHandler via the URL /handlers/MyHandler on your website.
MyHandler
/handlers/MyHandler
Apache2::ASP::Handler offers an "in-between" ASP environment in which there is no Perl embedded within HTML (via <% and %> tags) but you still get the ASP objects ($Request, $Response, $Session, $Server and $Application).
$Request
$Response
$Session
$Server
$Application
Handlers are useful for things like form processing when no HTML content is sent back to the client (because the client is redirected to another ASP instead).
The following methods are intended for subclasses of Apache2::ASP::Handler.
Apache2::ASP::Handler
Works just like the example in the synopsis.
Allows your Handler class to handle "mode=xxx" requests for other Handlers.
Example:
package MyHandler; use base 'SomeDefaultHandler'; __PACKAGE__->register_mode( name => 'mymode', handler => \&do_mymode, ); # Accessible via URLs such as /handler/SomeDefaultHandler?mode=mymode sub do_mymode { my ($Session, $Request, $Response, $Server, $Application) = @_; # ... do stuff ... $Response->Write("mymode is successful!"); }# end do_mymode()
Any call to /media/file123.gif?mode=mymode will execute your do_mymode() method.
/media/file123.gif?mode=mymode
do_mymode()
This is useful for generating image thumbnails - i.e. /media/file123.gif?mode=thumb&max_w=100&max_h=80
/media/file123.gif?mode=thumb&max_w=100&max_h=80
The rest is left as an exercise for the reader.
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 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.