line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Apache::ASP::GlobalASA; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# GlobalASA Object |
5
|
|
|
|
|
|
|
# global.asa processes, whether or not there is a global.asa file. |
6
|
|
|
|
|
|
|
# if there is not one, the code is left blank, and empty routines |
7
|
|
|
|
|
|
|
# are filled in |
8
|
|
|
|
|
|
|
|
9
|
46
|
|
|
46
|
|
312
|
use strict; |
|
46
|
|
|
|
|
162
|
|
|
46
|
|
|
|
|
4377
|
|
10
|
46
|
|
|
46
|
|
389
|
no strict qw(refs); |
|
46
|
|
|
|
|
123
|
|
|
46
|
|
|
|
|
1971
|
|
11
|
46
|
|
|
46
|
|
348
|
use vars qw(%stash *stash @ISA @Routines); |
|
46
|
|
|
|
|
95
|
|
|
46
|
|
|
|
|
106323
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# these define the default routines that get parsed out of the |
14
|
|
|
|
|
|
|
# GLOBAL.ASA file |
15
|
|
|
|
|
|
|
@Routines = |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
"Application_OnStart", |
18
|
|
|
|
|
|
|
"Application_OnEnd", |
19
|
|
|
|
|
|
|
"Session_OnStart", |
20
|
|
|
|
|
|
|
"Session_OnEnd", |
21
|
|
|
|
|
|
|
"Script_OnStart", |
22
|
|
|
|
|
|
|
"Script_OnEnd", |
23
|
|
|
|
|
|
|
"Script_OnParse", |
24
|
|
|
|
|
|
|
"Script_OnFlush" |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
my $match_events = join('|', @Routines); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
69
|
|
50
|
69
|
0
|
348
|
my $asp = shift || die("no asp passed to GlobalASA"); |
30
|
|
|
|
|
|
|
|
31
|
69
|
|
|
|
|
264
|
my $filename = $asp->{global}.'/global.asa'; |
32
|
69
|
|
|
|
|
419
|
my $id = &Apache::ASP::FileId($asp, $asp->{global}, undef, 1); |
33
|
69
|
100
|
|
|
|
545
|
my $package = $asp->{global_package} ? $asp->{global_package} : "Apache::ASP::Compiles::".$id; |
34
|
69
|
|
|
|
|
238
|
$id .= 'x'.$package; # need to recompile when either file or namespace changes |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# make sure that when either the file or package changes, that we |
37
|
|
|
|
|
|
|
# update the global.asa compilation |
38
|
|
|
|
|
|
|
|
39
|
69
|
|
|
|
|
673
|
my $self = bless { |
40
|
|
|
|
|
|
|
asp => $asp, |
41
|
|
|
|
|
|
|
'package' => $package, |
42
|
|
|
|
|
|
|
# filename => $filename, |
43
|
|
|
|
|
|
|
# id => $id, |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# assign early, since something like compiling reference the global asa, |
47
|
|
|
|
|
|
|
# and we need to do that in here |
48
|
69
|
|
|
|
|
219
|
$asp->{GlobalASA} = $self; |
49
|
|
|
|
|
|
|
|
50
|
69
|
100
|
|
|
|
363
|
$asp->{dbg} && $asp->Debug("GlobalASA package $self->{'package'}"); |
51
|
69
|
|
|
|
|
698
|
my $compiled = $Apache::ASP::Compiled{$id}; |
52
|
69
|
50
|
66
|
|
|
404
|
if($compiled && ! $asp->{stat_scripts}) { |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# $asp->{dbg} && $asp->Debug("no stat: GlobalASA already compiled"); |
55
|
0
|
|
|
|
|
0
|
$self->{'exists'} = $compiled->{'exists'}; |
56
|
0
|
|
|
|
|
0
|
$self->{'compiled'} = $compiled; # for event lookups |
57
|
0
|
|
|
|
|
0
|
return $self; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
69
|
100
|
|
|
|
258
|
if($compiled) { |
61
|
|
|
|
|
|
|
# $asp->{dbg} && $asp->Debug("global.asa was cached for $id"); |
62
|
|
|
|
|
|
|
} else { |
63
|
48
|
100
|
|
|
|
473
|
$asp->{dbg} && $asp->Debug("global.asa was not cached for $id"); |
64
|
48
|
|
|
|
|
823
|
$compiled = $Apache::ASP::Compiled{$id} = { mtime => 0, 'exists' => 0 }; |
65
|
|
|
|
|
|
|
} |
66
|
69
|
|
|
|
|
379
|
$self->{compiled} = $compiled; |
67
|
|
|
|
|
|
|
|
68
|
69
|
|
|
|
|
1342
|
my $exists = $self->{'exists'} = -e $filename; |
69
|
69
|
|
|
|
|
421
|
my $changed = 0; |
70
|
69
|
100
|
66
|
|
|
1212
|
if(! $exists && ! $compiled->{'exists'}) { |
|
|
50
|
33
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
71
|
|
|
|
|
|
|
# fastest exit for simple case of no global.asa |
72
|
3
|
|
|
|
|
15
|
return $self; |
73
|
|
|
|
|
|
|
} elsif(! $exists && $compiled->{'exists'}) { |
74
|
|
|
|
|
|
|
# if the global.asa disappeared |
75
|
0
|
|
|
|
|
0
|
$changed = 1; |
76
|
|
|
|
|
|
|
} elsif($exists && ! $compiled->{'exists'}) { |
77
|
|
|
|
|
|
|
# if global.asa reappeared |
78
|
45
|
|
|
|
|
126
|
$changed = 1; |
79
|
|
|
|
|
|
|
} else { |
80
|
21
|
50
|
|
|
|
121
|
$self->{mtime} = $exists ? (stat(_))[9] : 0; |
81
|
21
|
50
|
|
|
|
96
|
if($self->{mtime} > $compiled->{mtime}) { |
82
|
|
|
|
|
|
|
# if the modification time is greater than the compile time |
83
|
0
|
|
|
|
|
0
|
$changed = 1; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
66
|
100
|
|
|
|
431
|
$changed || return($self); |
87
|
|
|
|
|
|
|
|
88
|
45
|
50
|
|
|
|
286
|
my $code = $exists ? ${$asp->ReadFile($filename)} : ""; |
|
45
|
|
|
|
|
345
|
|
89
|
45
|
100
|
|
|
|
252
|
my $strict = $asp->{use_strict} ? "use strict" : "no strict"; |
90
|
|
|
|
|
|
|
|
91
|
45
|
100
|
|
|
|
25619
|
if($code =~ s/\ |