line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Instantiate components by type and name |
2
|
|
|
|
|
|
|
$Dancer2::Core::Factory::VERSION = '0.400000'; |
3
|
|
|
|
|
|
|
use Moo; |
4
|
144
|
|
|
144
|
|
2630
|
use Dancer2::Core; |
|
144
|
|
|
|
|
11470
|
|
|
144
|
|
|
|
|
957
|
|
5
|
144
|
|
|
144
|
|
46608
|
use Module::Runtime 'use_module'; |
|
144
|
|
|
|
|
354
|
|
|
144
|
|
|
|
|
3813
|
|
6
|
144
|
|
|
144
|
|
1798
|
use Carp 'croak'; |
|
144
|
|
|
|
|
3247
|
|
|
144
|
|
|
|
|
923
|
|
7
|
144
|
|
|
144
|
|
6766
|
|
|
144
|
|
|
|
|
353
|
|
|
144
|
|
|
|
|
23659
|
|
8
|
|
|
|
|
|
|
my ( $class, $type, $name, %options ) = @_; |
9
|
|
|
|
|
|
|
|
10
|
831
|
|
|
831
|
0
|
31005
|
$type = Dancer2::Core::camelize($type); |
11
|
|
|
|
|
|
|
$name = Dancer2::Core::camelize($name); |
12
|
831
|
|
|
|
|
3555
|
my $component_class = "Dancer2::${type}::${name}"; |
13
|
831
|
|
|
|
|
2125
|
|
14
|
831
|
|
|
|
|
2562
|
eval { use_module($component_class); 1; } |
15
|
|
|
|
|
|
|
or croak "Unable to load class for $type component $name: $@"; |
16
|
831
|
100
|
|
|
|
1566
|
|
|
831
|
|
|
|
|
3237
|
|
|
830
|
|
|
|
|
33145
|
|
17
|
|
|
|
|
|
|
return $component_class->new(%options); |
18
|
|
|
|
|
|
|
} |
19
|
830
|
|
|
|
|
10028
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=encoding UTF-8 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Dancer2::Core::Factory - Instantiate components by type and name |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 VERSION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
version 0.400000 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 AUTHOR |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Dancer Core Developers |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Alexis Sukrieh. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
44
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |