package Apache2::ASP::GlobalASA; use strict; use warnings 'all'; use vars qw($Request $Response $Session $Application $Server $Form $Config); #============================================================================== sub new { my ($class, $asp) = @_; my $s = bless { asp => $asp }, $class; $s->_init_globals(); return $s; }# end new() #============================================================================== sub _init_globals { my ($s) = @_; no strict 'refs'; my $class = ref($s); $Request = ${"$class\::Request"} = $s->{asp}->request; $Response = ${"$class\::Response"} = $s->{asp}->response; $Session = ${"$class\::Session"} = $s->{asp}->session; $Form = ${"$class\::Form"} = $s->{asp}->request->Form; $Application = ${"$class\::Application"} = $s->{asp}->application; $Server = ${"$class\::Server"} = $s->{asp}->server; $Config = ${"$class\::Config"} = $s->{asp}->config; return 1; }# end _init_globals() #============================================================================== sub Application_OnStart { }# end Application_OnStart() #============================================================================== sub Server_OnStart { }# end Server_OnStart() #============================================================================== sub Script_OnParse { my ($script_ref) = @_; }# end Script_OnParse() #============================================================================== sub Script_OnFlush { my ($ref) = @_; }# end Script_OnFlush() #============================================================================== sub Script_OnStart { }# end Script_OnStart() #============================================================================== sub Script_OnEnd { }# end Script_OnEnd() #============================================================================== sub Script_OnError { my ($error) = @_; $Response->Write(qq{
$error}); warn $error; $Response->End; }# end Script_OnError() #============================================================================== sub Session_OnStart { }# end Session_OnStart() #============================================================================== sub DESTROY { } 1;# return true: __END__ =pod =head1 NAME Apache2::ASP::GlobalASA - Base class for your GlobalASA =head1 SYNOPSIS package DefaultApp::GlobalASA; use base 'Apache2::ASP::GlobalASA'; use vars qw($Request $Response $Session $Application $Server $Form); # Override any methods here: # Executed at the beginning of *every* ASP script: sub Script_OnStart { warn "Starting up script!"; }# end Script_OnStart() # # Special error-handling method: sub Script_OnError { my $err; # Log the error: warn "[" . localtime() . "] An error has occurred: " . $err; # Print something friendly: $Response->Write("Sorry for the inconvenience. Please try again later."); # Email the webmaster: $Server->Mail( To => 'me@mydomain.com', Subject => '500 Server error', Message => "Please look at the following error:\n\n" . $err ); # Done! $Response->End; }# end Script_OnError() 1;# return true: =head1 DESCRIPTION The C