line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::Singleton::Request; |
2
|
|
|
|
|
|
|
$Apache::Singleton::Request::VERSION = '0.16'; |
3
|
|
|
|
|
|
|
# ABSTRACT: One instance per One Request |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
36253
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
6
|
2
|
|
|
2
|
|
8
|
use base 'Apache::Singleton'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
604
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BEGIN { |
9
|
2
|
100
|
|
2
|
|
9
|
use constant MP2 => $mod_perl::VERSION >= 1.99 ? 1 : 0; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
190
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
4
|
if (MP2) { |
12
|
|
|
|
|
|
|
require Apache2::RequestUtil; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
else { |
15
|
2
|
|
|
|
|
427
|
require Apache; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _get_instance { |
20
|
8
|
|
|
8
|
|
10
|
my $class = shift; |
21
|
8
|
|
|
|
|
21
|
my $r = MP2 ? Apache2::RequestUtil->request : Apache->request; |
22
|
8
|
|
|
|
|
30
|
my $key = "apache_singleton_$class"; |
23
|
8
|
|
|
|
|
19
|
return $r->pnotes($key); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _set_instance { |
27
|
4
|
|
|
4
|
|
7
|
my($class, $instance) = @_; |
28
|
4
|
|
|
|
|
488
|
my $r = MP2 ? Apache2::RequestUtil->request : Apache->request; |
29
|
4
|
|
|
|
|
17
|
my $key = "apache_singleton_$class"; |
30
|
4
|
|
|
|
|
10
|
$r->pnotes($key => $instance); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |