line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Mint::Singleton; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
51
|
use Carp; |
|
15
|
|
|
|
|
16
|
|
|
15
|
|
|
|
|
859
|
|
4
|
15
|
|
|
15
|
|
6067
|
use Moo; |
|
15
|
|
|
|
|
144584
|
|
|
15
|
|
|
|
|
72
|
|
5
|
|
|
|
|
|
|
with 'MooX::Singleton'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has pool => (is => 'rw', default => sub { {} } ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub add_instance { |
10
|
16
|
|
|
16
|
0
|
24
|
my ($self, $mint) = @_; |
11
|
16
|
50
|
|
|
|
87
|
if (exists $self->pool->{$mint->name}) { |
12
|
0
|
|
|
|
|
0
|
$mint = $self->pool->{$mint->name}; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
else { |
15
|
16
|
|
|
|
|
65
|
$self->pool->{$mint->name} = $mint; |
16
|
|
|
|
|
|
|
} |
17
|
16
|
|
|
|
|
232
|
return $mint; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub get_instance { |
21
|
174
|
|
|
174
|
0
|
199
|
my ($self, $name) = @_; |
22
|
174
|
50
|
|
|
|
1112
|
return exists $self->pool->{$name} ? |
23
|
|
|
|
|
|
|
$self->pool->{$name} : undef; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub exists { |
27
|
191
|
|
|
191
|
0
|
236
|
my ($self, $name) = @_; |
28
|
191
|
|
|
|
|
1197
|
return exists $self->pool->{$name}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |