1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
package Apache::RegistryNG;
use Apache::PerlRun ();
use Apache::Constants qw(:common);
use strict;
use vars qw($VERSION @ISA);
$VERSION = '1.00';
@ISA = qw(Apache::PerlRun);
#OO replacement for Apache::Registry
#configure like so:
# <Location /perl>
# SetHandler perl-script
# PerlHandler Apache::RegistryNG->handler
# Options +ExecCGI
# </Location>
# see also: Apache::RegistryBB
sub namespace_from {
shift->filename;
}
sub handler ($$) {
my($class, $r);
if (@_ >= 2) {
($class, $r) = (shift, shift);
}
else {
($class, $r) = (__PACKAGE__, shift);
}
my $pr = $class->new($r);
my $rc = $pr->can_compile;
return $rc unless $rc == OK;
local $^W = $^W;
my $package = $pr->namespace;
$pr->set_script_name;
$pr->chdir_file;
if($pr->should_compile) {
$pr->readscript;
$pr->parse_cmdline;
$pr->sub_wrap;
my $rc = $pr->compile;
return $rc if $rc != OK;
$pr->update_mtime;
}
$rc = $pr->run(@_);
$pr->chdir_file("$Apache::Server::CWD/");
return ($rc != OK) ? $rc : $pr->status;
}
1;
__END__
|