line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::DIC::ServiceFactoryFactory; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require Exporter; |
4
|
|
|
|
|
|
|
@ISA = qw/Exporter/; |
5
|
|
|
|
|
|
|
@EXPORT_OK = qw/build_factory/; |
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
33
|
use aliased 'MooseX::DIC::ContainerException'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
30
|
|
8
|
5
|
|
|
5
|
|
2311
|
use Module::Load; |
|
5
|
|
|
|
|
4877
|
|
|
5
|
|
|
|
|
35
|
|
9
|
5
|
|
|
5
|
|
246
|
use Try::Tiny; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
855
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub build_factory { |
12
|
9
|
|
|
9
|
0
|
29
|
my ( $factory_type, $container ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
9
|
|
|
|
|
16
|
my $service_factory; |
15
|
|
|
|
|
|
|
try { |
16
|
9
|
|
|
9
|
|
406
|
load "MooseX::DIC::ServiceFactory::$factory_type"; |
17
|
|
|
|
|
|
|
|
18
|
9
|
|
|
|
|
646
|
$service_factory = "MooseX::DIC::ServiceFactory::$factory_type" |
19
|
|
|
|
|
|
|
->new( container => $container ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} catch { |
22
|
0
|
|
|
0
|
|
0
|
ContainerException->throw( |
23
|
|
|
|
|
|
|
message => "Could not build the service factory $factory_type: $_" ); |
24
|
9
|
|
|
|
|
87
|
}; |
25
|
|
|
|
|
|
|
|
26
|
9
|
|
|
|
|
197
|
return $service_factory; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |