line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package IOC::Service::Parameterized; |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
13159
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
223
|
|
5
|
6
|
|
|
6
|
|
32
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
318
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
8
|
|
|
|
|
|
|
|
9
|
6
|
|
|
6
|
|
36
|
use Scalar::Util qw(blessed); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
420
|
|
10
|
|
|
|
|
|
|
|
11
|
6
|
|
|
6
|
|
34
|
use IOC::Exceptions; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
191
|
|
12
|
|
|
|
|
|
|
|
13
|
6
|
|
|
6
|
|
30
|
use base 'IOC::Service::Prototype'; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
6197
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub instance { |
16
|
7
|
|
|
7
|
1
|
1045
|
my ($self, %params) = @_; |
17
|
7
|
50
|
|
|
|
24
|
(defined($self->{container})) |
18
|
|
|
|
|
|
|
|| throw IOC::IllegalOperation "Cannot create a service instance without setting container"; |
19
|
|
|
|
|
|
|
# we need to be sure to not store this value |
20
|
|
|
|
|
|
|
# otherwise we will add a ref count to it |
21
|
7
|
|
|
|
|
80
|
return $self->{block}->($self->{container}, %params); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub deferred { |
25
|
0
|
|
|
0
|
1
|
|
throw IOC::IllegalOperation "Parameterized services cannot be deferred"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |