line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::Singleton::Process; |
2
|
|
|
|
|
|
|
$Apache::Singleton::Process::VERSION = '0.16'; |
3
|
|
|
|
|
|
|
# ABSTRACT: One instance per One Process |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
16733
|
use strict; |
|
7
|
|
|
|
|
13
|
|
|
7
|
|
|
|
|
215
|
|
6
|
7
|
|
|
7
|
|
25
|
use base 'Apache::Singleton'; |
|
7
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
853
|
|
7
|
|
|
|
|
|
|
|
8
|
7
|
|
|
7
|
|
36
|
no strict 'refs'; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
679
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %INSTANCES; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _get_instance { |
13
|
14
|
|
|
14
|
|
15
|
my $class = shift; |
14
|
|
|
|
|
|
|
|
15
|
14
|
|
33
|
|
|
47
|
$class = ref $class || $class; |
16
|
|
|
|
|
|
|
|
17
|
14
|
|
|
|
|
29
|
return $INSTANCES{$class}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _set_instance { |
21
|
6
|
|
|
6
|
|
9
|
my($class, $instance) = @_; |
22
|
|
|
|
|
|
|
|
23
|
6
|
|
33
|
|
|
28
|
$class = ref $class || $class; |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
|
|
16
|
$INSTANCES{$class} = $instance; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
END { |
29
|
|
|
|
|
|
|
# dereferences and causes orderly destruction of all instances |
30
|
7
|
|
|
7
|
|
6670
|
undef(%INSTANCES); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |