line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EO::Singleton; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
21323
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
93
|
|
4
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
94
|
|
5
|
3
|
|
|
3
|
|
1850
|
use EO; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @ISA = qw( EO ); |
8
|
|
|
|
|
|
|
our $VERSION = 0.96; |
9
|
|
|
|
|
|
|
my $_singletons = {}; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
|
|
|
|
|
|
my $class = shift; |
13
|
|
|
|
|
|
|
$_singletons->{$class} ||= $class->SUPER::new(@_); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _reset_singleton { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
$_singletons->{ ref($self) } = $self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get { |
22
|
|
|
|
|
|
|
my $self = ref($_[0]) ? shift : shift->new; |
23
|
|
|
|
|
|
|
$self->SUPER::get( @_ ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub set { |
27
|
|
|
|
|
|
|
my $self = ref($_[0]) ? shift : shift->new; |
28
|
|
|
|
|
|
|
$self->SUPER::set( @_ ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub clone { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |