line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Run::Base::Plugger; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
20774
|
use strict; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
466
|
|
4
|
18
|
|
|
18
|
|
90
|
use warnings; |
|
18
|
|
|
|
|
33
|
|
|
18
|
|
|
|
|
463
|
|
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
886
|
use Moose; |
|
18
|
|
|
|
|
468674
|
|
|
18
|
|
|
|
|
104
|
|
7
|
|
|
|
|
|
|
|
8
|
18
|
|
|
18
|
|
111740
|
use MRO::Compat; |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
620
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends ("Test::Run::Base"); |
11
|
|
|
|
|
|
|
|
12
|
18
|
|
|
18
|
|
96
|
use Carp; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
4079
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require UNIVERSAL::require; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Test::Run::Base::Plugger - an object class with plug-ins. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This is a class that abstracts an object class with plugins. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has '_base' => (is => "rw", isa => "Str", init_arg => "base", ); |
29
|
|
|
|
|
|
|
has '_into' => (is => "rw", isa => "Str", init_arg => "into", ); |
30
|
|
|
|
|
|
|
has '_plugins' => (is => "rw", isa => "ArrayRef", |
31
|
|
|
|
|
|
|
default => sub { []; }, lazy => 1 |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 $plugger = Test::Run::Base::Plugger->new({base => $base, into => $into}) |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$base is the base class and $into is the namespace to put everything into. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 BUILD |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
For Moose. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub BUILD |
45
|
|
|
|
|
|
|
{ |
46
|
205
|
|
|
205
|
1
|
211181
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
205
|
|
|
|
|
771
|
$self->_update_ISA(); |
49
|
|
|
|
|
|
|
|
50
|
204
|
|
|
|
|
751
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _update_ISA |
54
|
|
|
|
|
|
|
{ |
55
|
409
|
|
|
409
|
|
659
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
409
|
|
|
|
|
15406
|
my $base_class = $self->_base(); |
58
|
409
|
|
|
|
|
14583
|
my $into_class = $self->_into(); |
59
|
|
|
|
|
|
|
|
60
|
18
|
|
|
18
|
|
101
|
my $isa_ref = do { no strict 'refs'; \@{"${into_class}::ISA"} }; |
|
18
|
|
|
|
|
33
|
|
|
18
|
|
|
|
|
4743
|
|
|
409
|
|
|
|
|
649
|
|
|
409
|
|
|
|
|
613
|
|
|
409
|
|
|
|
|
3112
|
|
61
|
|
|
|
|
|
|
|
62
|
409
|
|
|
|
|
7894
|
@$isa_ref = (); |
63
|
|
|
|
|
|
|
|
64
|
409
|
|
|
|
|
1351
|
foreach my $plugin (@{$self->_plugins()}) |
|
409
|
|
|
|
|
15207
|
|
65
|
|
|
|
|
|
|
{ |
66
|
5
|
100
|
|
|
|
35
|
if (!$plugin->require()) |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
|
|
64
|
die $@; |
69
|
|
|
|
|
|
|
} |
70
|
4
|
|
|
|
|
557
|
push @$isa_ref, $plugin; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
408
|
100
|
|
|
|
2587
|
if (!$base_class->require()) |
74
|
|
|
|
|
|
|
{ |
75
|
1
|
|
|
|
|
97
|
die $@; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
407
|
|
|
|
|
38306
|
push @$isa_ref, $base_class; |
79
|
|
|
|
|
|
|
|
80
|
407
|
|
|
|
|
1418
|
return; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 $plugger->add_plugins(\@plugins) |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Adds @plugins to the list of plugins used by the $into module. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub add_plugins |
90
|
|
|
|
|
|
|
{ |
91
|
204
|
|
|
204
|
1
|
613
|
my $self = shift; |
92
|
204
|
|
|
|
|
396
|
my $more_plugins = shift; |
93
|
|
|
|
|
|
|
|
94
|
204
|
|
|
|
|
378
|
push @{$self->_plugins()}, @{$more_plugins}; |
|
204
|
|
|
|
|
8284
|
|
|
204
|
|
|
|
|
479
|
|
95
|
|
|
|
|
|
|
|
96
|
204
|
|
|
|
|
583
|
$self->_update_ISA(); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 $pluggin->create_new(@args) |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Constructs a new instance of $into. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub create_new |
106
|
|
|
|
|
|
|
{ |
107
|
203
|
|
|
203
|
1
|
1104
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
203
|
|
|
|
|
7423
|
return $self->_into()->new(@_); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 LICENSE |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This file is freely distributable under the MIT X11 license. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
L<http://www.opensource.org/licenses/mit-license.php> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 AUTHOR |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Shlomi Fish, L<http://www.shlomifish.org/>. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|