| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Run::Base::Plugger; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
64633
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4198
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use MRO::Compat; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends ("Test::Run::Base"); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Carp; |
|
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
|
|
|
|
|
|
|
my $self = shift; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->_update_ISA(); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _update_ISA |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
|
|
|
|
|
|
my $self = shift; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $base_class = $self->_base(); |
|
58
|
|
|
|
|
|
|
my $into_class = $self->_into(); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $isa_ref = do { no strict 'refs'; \@{"${into_class}::ISA"} }; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
@$isa_ref = (); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
foreach my $plugin (@{$self->_plugins()}) |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
|
|
|
|
|
|
if (!$plugin->require()) |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
|
|
|
|
|
|
die $@; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
push @$isa_ref, $plugin; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
if (!$base_class->require()) |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
|
|
|
|
|
|
die $@; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
push @$isa_ref, $base_class; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
my $self = shift; |
|
92
|
|
|
|
|
|
|
my $more_plugins = shift; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
push @{$self->_plugins()}, @{$more_plugins}; |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$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
|
|
|
|
|
|
|
my $self = shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|