line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Component::Component::DisableDynamicPlugin; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
107
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
91
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use Carp::Clan qw/Class::Component/; |
|
3
|
|
|
|
|
47
|
|
|
3
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %component_params = ( |
9
|
|
|
|
|
|
|
components => {}, |
10
|
|
|
|
|
|
|
plugins => {}, |
11
|
|
|
|
|
|
|
methods => {}, |
12
|
|
|
|
|
|
|
plugins => {}, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
for my $name (qw/ components plugins /) { |
16
|
|
|
|
|
|
|
my $method = "class_component_$name"; |
17
|
3
|
|
|
3
|
|
626
|
no strict 'refs'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
492
|
|
18
|
|
|
|
|
|
|
*{__PACKAGE__."::$method"} = sub { |
19
|
6
|
|
|
6
|
|
16
|
my $class = shift; |
20
|
6
|
|
33
|
|
|
42
|
$class = ref($class) || $class; |
21
|
6
|
50
|
|
|
|
24
|
$component_params{$name}->{$class} = $_[0] if $_[0]; |
22
|
6
|
100
|
|
|
|
37
|
$component_params{$name}->{$class} = [] unless $component_params{$name}->{$class}; |
23
|
6
|
|
|
|
|
26
|
$component_params{$name}->{$class}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for my $name (qw/ methods hooks /) { |
28
|
|
|
|
|
|
|
my $method = "class_component_$name"; |
29
|
3
|
|
|
3
|
|
26
|
no strict 'refs'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1114
|
|
30
|
|
|
|
|
|
|
*{__PACKAGE__."::$method"} = sub { |
31
|
56
|
|
|
56
|
|
88
|
my $class = shift; |
32
|
56
|
|
66
|
|
|
186
|
$class = ref($class) || $class; |
33
|
56
|
50
|
|
|
|
114
|
$component_params{$name}->{$class} = $_[0] if $_[0]; |
34
|
56
|
100
|
|
|
|
179
|
$component_params{$name}->{$class} = {} unless $component_params{$name}->{$class}; |
35
|
56
|
|
|
|
|
581
|
$component_params{$name}->{$class}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub class_component_config { |
40
|
6
|
|
|
6
|
0
|
16
|
my $class = shift; |
41
|
6
|
50
|
50
|
|
|
62
|
return Class::Component::Implement->default_configs->{$class} || {} unless ref($class); |
42
|
0
|
0
|
|
|
|
0
|
$class->{_class_component_config} || {}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub load_plugins { |
46
|
12
|
|
|
12
|
0
|
36
|
my($class, @plugins) = @_; |
47
|
12
|
100
|
|
|
|
50
|
return if ref($class); |
48
|
|
|
|
|
|
|
|
49
|
6
|
|
|
|
|
31
|
Class::Component::Implement->load_plugins_default($class, @plugins); |
50
|
6
|
|
|
|
|
16
|
for my $plugin (@plugins) { |
51
|
6
|
|
|
|
|
33
|
Class::Component::Implement->_load_plugin($class, $plugin); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub class_component_load_component_init { |
56
|
3
|
|
|
3
|
0
|
7
|
my($class, $c) = @_; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
42
|
my $default_components = Class::Component::Implement->default_components->{$c}; |
59
|
3
|
50
|
|
|
|
15
|
$component_params{components}->{$c} = $default_components if $default_components; |
60
|
|
|
|
|
|
|
|
61
|
3
|
|
|
|
|
15
|
my $default_plugins = Class::Component::Implement->default_plugins->{$c}; |
62
|
3
|
50
|
|
|
|
13
|
if ($default_plugins) { |
63
|
3
|
|
|
|
|
7
|
$c->load_plugins(@{ $default_plugins }); |
|
3
|
|
|
|
|
21
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |