package Apache2::ASP; use strict; use warnings 'all'; use base 'Apache2::ASP::Base'; use Apache2::ASP::CGI; use Apache2::ASP::UploadHook; use APR::Table (); use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Directive (); use Apache2::Connection (); use Apache2::SubRequest (); use Apache2::RequestUtil (); use vars '$VERSION'; $VERSION = '1.56_1'; #============================================================================== sub handler : method { my ($class, $r) = @_; # We function best as an object: my $s = $class->SUPER::new( $ENV{APACHE2_ASP_CONFIG} ); $main::_ASP::ASP = $s; $s->{r} = $r; # What Apache2::ASP::Handler is going to handle this request? if( uc($ENV{REQUEST_METHOD}) eq 'POST' ) { my $handler_class = $s->resolve_request_handler( $r->uri ); if( $handler_class->isa('Apache2::ASP::UploadHandler') ) { # We use the upload_hook functionality from Apache::Request # to process uploads: my $hook_obj = Apache2::ASP::UploadHook->new( asp => $s, handler_class => $handler_class, ); $s->{'q'} = Apache2::ASP::CGI->new( $r, sub { $hook_obj->hook( @_ ) } ); } else { # Not an upload - normal CGI functionality will work fine: $s->{'q'} = Apache2::ASP::CGI->new( $r ); }# end if() } else { # Not an upload - normal CGI functionality will work fine: $s->{'q'} = Apache2::ASP::CGI->new( $r ); }# end if() # Get our subref and execute it: $s->setup_request( $r, $s->{'q'} ); my $status = eval { $s->execute() }; if( $@ ) { warn "ERROR AFTER CALLING \$handler->( ): $@"; return $s->_handle_error( $@ ); }# end if() # 0 = OK, everything else means errors of some kind: return $status eq '200' ? 0 : $status; }# end handler() #============================================================================== sub _handle_error { my ($s, $err) = @_; warn $err; $s->response->Clear(); $s->global_asa->can('Script_OnError')->( $err ); return 500; }# end _handle_error() 1;# return true: __END__ =pod =head1 NAME Apache2::ASP - Perl extension for ASP on mod_perl2. =head1 SYNOPSIS =head2 In your ASP script
<%= "Hello, World!" %>