line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Component::Component::AutoloadPlugin; |
2
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
527
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub autoload_plugins { |
6
|
6
|
|
|
6
|
0
|
16
|
my($class, @plugins) = @_; |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
|
|
27
|
for my $plugin (@plugins) { |
9
|
6
|
100
|
|
|
|
24
|
my $name = ref $plugin ? $plugin->{module} : $plugin; |
10
|
6
|
100
|
|
|
|
19
|
unless (_is_loaded($class, $name)) { |
11
|
3
|
|
|
|
|
25
|
$class->load_plugins($plugin); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _is_loaded { |
17
|
6
|
|
|
6
|
|
9
|
my ($c, $stuff) = @_; |
18
|
|
|
|
|
|
|
|
19
|
6
|
|
33
|
|
|
20
|
my $base = ref $c || $c; |
20
|
|
|
|
|
|
|
|
21
|
6
|
|
|
|
|
12
|
for my $plugin (@{ $c->class_component_plugins }) { |
|
6
|
|
|
|
|
25
|
|
22
|
9
|
|
|
|
|
19
|
my $module = ref $plugin; |
23
|
9
|
|
|
|
|
14
|
my $pkg = $stuff; |
24
|
9
|
100
|
|
|
|
35
|
unless (($pkg = $stuff) =~ s/^\+//) { |
25
|
6
|
|
|
|
|
51
|
$module =~ s/^$base\::Plugin\:://; |
26
|
|
|
|
|
|
|
} |
27
|
9
|
100
|
|
|
|
53
|
return 1 if $pkg eq $module; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
11
|
return; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |