/usr/share/perl5/Apache/ASP/Load.pm is in libapache-asp-perl 2.62-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | package Apache::ASP::Load;
use Apache::ASP;
use Apache::ASP::CGI::Table;
use strict;
no strict qw(refs);
use vars qw(@Days @Months $AUTOLOAD $LOADED $COUNT);
@Days = qw(Sun Mon Tue Wed Thu Fri Sat);
@Months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
# we need a different class from Apache::ASP::CGI because we don't
# want to force use of CGI & Class::Struct when loading ASP in Apache
# also a nasty bug doesn't allow us to eval require's or use's, we
# get a can't start_mutex
sub new {
my($file) = @_;
bless {
current_callback => 'PerlHandler',
filename => $file,
remote_ip => '127.0.0.1',
user => undef,
method => 'GET',
NoState => 1,
headers_in => Apache::ASP::CGI::Table->new,
headers_out => Apache::ASP::CGI::Table->new,
dir_config => Apache::ASP::CGI::Table->new,
subprocess_env => Apache::ASP::CGI::Table->new,
};
}
sub AUTOLOAD {
$AUTOLOAD =~ s/^(.*)::([^:]*)$/$2/;
shift->{$AUTOLOAD};
}
sub log_error {
shift;
my @times = localtime;
printf STDERR ('[%s %s %02d %02d:%02d:%02d %d] [error] %s'."\n",
$Days[$times[6]],
$Months[$times[4]],
$times[3],
$times[2],
$times[1],
$times[0],
$times[5] + 1900,
join('', @_),
);
}
sub connection { shift; }
sub Run {
shift if(ref $_[0] or $_[0] eq 'Apache::ASP');
local $SIG{__WARN__} = \&Apache::ASP::Warn;
my($file, $match, %args) = @_;
unless(-e $file) {
warn("$file does not exist for loading");
return;
}
$match ||= '.*'; # compile all by default
# recurse down directories and compile the scripts
if(-d $file && ! -l $file) {
$file =~ s|/$||;
opendir(DIR, $file) || die("can't open $file for reading: $!");
my @files = readdir(DIR);
close DIR;
unless(@files) {
Apache::ASP::Load->log_error("[asp] $$ [WARN] can't read files in $file");
return;
}
my $top;
if(! defined $LOADED) {
$top = 1;
}
defined $LOADED or (local $LOADED = 0);
defined $COUNT or (local $COUNT = 0);
for(@files) {
chomp;
next if /^\.\.?$/;
&Run("$file/$_", $match, %args);
}
if($top) {
Apache::ASP::Load->log_error("[asp] $$ (re)compiled $LOADED scripts of $COUNT loaded for $file");
}
return;
}
# now the real work
unless($file =~ /$match/) {
if($args{Debug} and $args{Debug} < 0) {
Apache::ASP::Load->log_error("skipping compile of $file no match $match");
}
return;
}
unless($file =~ /$match/) {
if($args{Debug} < 0) {
warn("skipping compile of $file no match $match");
}
return;
}
my $r = Apache::ASP::Load::new($file);
for my $key (
qw( Debug StatINC StatINCMatch ),
@{Apache::ASP->CompileChecksumKeys}
)
{
$r->dir_config->set($key, $args{$key});
}
$r->dir_config->set('NoState', 1);
# RegisterIncludes created for precompilation, on by default here
$r->dir_config->set('RegisterIncludes', 1);
if ((defined $args{'RegisterIncludes'})) {
$r->dir_config->set('RegisterIncludes', $args{'RegisterIncludes'});
}
eval {
$COUNT++;
my $asp = Apache::ASP->new($r);
# if StatINC* is configured, run on first script
if(($COUNT == 1) && ($asp->config('StatINC') || $asp->config('StatINCMatch'))) {
$asp->StatINC;
}
my $rv = $asp->CompileInclude($asp->{'basename'})
|| die($@);
if($args{'Execute'}) {
local $^W = 0;
local *Apache::ASP::Response::Flush = sub {};
$asp->Run;
}
$asp->DESTROY;
$LOADED++;
};
$@ && warn($@);
return $LOADED;
}
1;
|