line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Component::Component::Plaggerize; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
14
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
5
|
use UNIVERSAL::require; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
1
|
|
|
1
|
|
87
|
my($class, %args) = @_; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
50
|
|
|
7
|
my $config = delete $args{plaggerize} || {}; |
11
|
1
|
|
50
|
|
|
7
|
$config->{plugins} ||= [qw/ PluginLoader Log ConfigLoader /]; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
1
|
my @plugins; |
14
|
1
|
|
|
|
|
2
|
for my $plugin (@{ $config->{plugins} }) { |
|
1
|
|
|
|
|
2
|
|
15
|
3
|
50
|
|
|
|
19
|
my $module = $plugin =~ s/^\+// ? $plugin : "Class::Component::Component::Plaggerize::$plugin"; |
16
|
3
|
50
|
|
|
|
26
|
$module->require or Carp::croak("Loading $module: $@"); |
17
|
3
|
|
|
|
|
51
|
push @plugins, $module; |
18
|
|
|
|
|
|
|
} |
19
|
1
|
50
|
|
|
|
6
|
if (@plugins) { |
20
|
1
|
|
|
1
|
|
187
|
no strict 'refs'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
378
|
|
21
|
1
|
|
|
|
|
1
|
my @isa ; |
22
|
1
|
|
|
|
|
3
|
for my $pkg (@{"$class\::ISA"}) { |
|
1
|
|
|
|
|
9
|
|
23
|
2
|
100
|
|
|
|
27
|
if ($pkg->isa(__PACKAGE__)) { |
24
|
1
|
|
|
|
|
6
|
push @isa, $pkg, @plugins; |
25
|
|
|
|
|
|
|
} else { |
26
|
1
|
|
|
|
|
4
|
push @isa, $pkg; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
1
|
|
|
|
|
2
|
@{"$class\::ISA"} = @isa; |
|
1
|
|
|
|
|
177
|
|
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
20
|
$class->class_component_clear_isa_list; |
32
|
|
|
|
|
|
|
} |
33
|
1
|
|
|
|
|
16
|
$class->NEXT( import => %args ); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub new { |
37
|
1
|
|
|
1
|
0
|
54
|
my($class, $args) = @_; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
50
|
|
|
7
|
my $config = delete $args->{config} || {}; |
40
|
1
|
|
|
|
|
3
|
$args->{config} = {}; |
41
|
1
|
|
|
|
|
6
|
my $self = $class->NEXT( new => $args ); |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
9
|
$self->conf( $class->setup_config($config) ); |
44
|
1
|
|
|
|
|
9
|
$self->setup_plugins; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
6
|
$self; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub conf { |
50
|
4
|
|
|
4
|
1
|
11
|
my $self = shift; |
51
|
4
|
100
|
|
|
|
40
|
$_[0] ? ( $self->{conf} = $_[0]) : $self->{conf}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
1
|
7
|
sub setup_config { shift->NEXT( setup_config => @_ ) } |
55
|
1
|
|
|
1
|
1
|
9
|
sub setup_plugins { shift->NEXT( setup_plugins => @_ ) } |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub log { shift->NEXT( log => @_ ) } |
58
|
0
|
|
|
0
|
1
|
|
sub should_log { shift->NEXT( should_log => @_ ) } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |