line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Run::Base::Plugger; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
69347
|
use strict; |
|
18
|
|
|
|
|
46
|
|
|
18
|
|
|
|
|
528
|
|
4
|
18
|
|
|
18
|
|
87
|
use warnings; |
|
18
|
|
|
|
|
30
|
|
|
18
|
|
|
|
|
444
|
|
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
641
|
use Moose; |
|
18
|
|
|
|
|
472509
|
|
|
18
|
|
|
|
|
96
|
|
7
|
|
|
|
|
|
|
|
8
|
18
|
|
|
18
|
|
104622
|
use MRO::Compat; |
|
18
|
|
|
|
|
41
|
|
|
18
|
|
|
|
|
693
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends ("Test::Run::Base"); |
11
|
|
|
|
|
|
|
|
12
|
18
|
|
|
18
|
|
108
|
use Carp; |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
3740
|
|
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
|
198413
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
205
|
|
|
|
|
881
|
$self->_update_ISA(); |
49
|
|
|
|
|
|
|
|
50
|
204
|
|
|
|
|
693
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _update_ISA |
54
|
|
|
|
|
|
|
{ |
55
|
409
|
|
|
409
|
|
776
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
409
|
|
|
|
|
11358
|
my $base_class = $self->_base(); |
58
|
409
|
|
|
|
|
11581
|
my $into_class = $self->_into(); |
59
|
|
|
|
|
|
|
|
60
|
18
|
|
|
18
|
|
142
|
my $isa_ref = do { no strict 'refs'; \@{"${into_class}::ISA"} }; |
|
18
|
|
|
|
|
68
|
|
|
18
|
|
|
|
|
4259
|
|
|
409
|
|
|
|
|
751
|
|
|
409
|
|
|
|
|
601
|
|
|
409
|
|
|
|
|
3408
|
|
61
|
|
|
|
|
|
|
|
62
|
409
|
|
|
|
|
11514
|
@$isa_ref = (); |
63
|
|
|
|
|
|
|
|
64
|
409
|
|
|
|
|
2191
|
foreach my $plugin (@{$self->_plugins()}) |
|
409
|
|
|
|
|
13202
|
|
65
|
|
|
|
|
|
|
{ |
66
|
5
|
100
|
|
|
|
35
|
if (!$plugin->require()) |
67
|
|
|
|
|
|
|
{ |
68
|
1
|
|
|
|
|
58
|
die $@; |
69
|
|
|
|
|
|
|
} |
70
|
4
|
|
|
|
|
701
|
push @$isa_ref, $plugin; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
408
|
100
|
|
|
|
2622
|
if (!$base_class->require()) |
74
|
|
|
|
|
|
|
{ |
75
|
1
|
|
|
|
|
126
|
die $@; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
407
|
|
|
|
|
42896
|
push @$isa_ref, $base_class; |
79
|
|
|
|
|
|
|
|
80
|
407
|
|
|
|
|
1494
|
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
|
607
|
my $self = shift; |
92
|
204
|
|
|
|
|
520
|
my $more_plugins = shift; |
93
|
|
|
|
|
|
|
|
94
|
204
|
|
|
|
|
428
|
push @{$self->_plugins()}, @{$more_plugins}; |
|
204
|
|
|
|
|
6412
|
|
|
204
|
|
|
|
|
484
|
|
95
|
|
|
|
|
|
|
|
96
|
204
|
|
|
|
|
678
|
$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
|
1256
|
my $self = shift; |
108
|
|
|
|
|
|
|
|
109
|
203
|
|
|
|
|
5533
|
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
|
|
|
|
|
|
|
|