The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Apache2::ASP::Handler - Base class for all Apache2::ASP handlers

SYNOPSIS

  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.

DESCRIPTION

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).

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).

METHODS

The following methods are intended for subclasses of Apache2::ASP::Handler.

run( $self, $asp, @args)

Works just like the example in the synopsis.

register_mode( %args )

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.

This is useful for generating image thumbnails - i.e. /media/file123.gif?mode=thumb&max_w=100&max_h=80

The rest is left as an exercise for the reader.

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.