| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Brickyard::Role::Plugin; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2907
|
use 5.010; |
|
|
3
|
|
|
|
|
9
|
|
|
|
3
|
|
|
|
|
120
|
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
87
|
|
|
5
|
3
|
|
|
3
|
|
16
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
122
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
17
|
use Role::Basic 0.12 allow => 'Brickyard::Accessor'; |
|
|
3
|
|
|
|
|
67
|
|
|
|
3
|
|
|
|
|
21
|
|
|
8
|
3
|
|
|
3
|
|
272
|
use Brickyard::Accessor new => 1, rw => [qw(brickyard name)]; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub plugins_with { |
|
11
|
2
|
|
|
2
|
1
|
20
|
my ($self, $role) = @_; |
|
12
|
2
|
|
|
|
|
6
|
$self->brickyard->plugins_with($role); |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub normalize_param { |
|
16
|
1
|
|
|
1
|
1
|
2
|
my ($self, $param) = @_; |
|
17
|
1
|
50
|
|
|
|
4
|
return [] unless defined $param; |
|
18
|
1
|
50
|
|
|
|
30
|
if (wantarray) { |
|
19
|
1
|
50
|
|
|
|
6
|
return ref $param eq 'ARRAY' ? @$param : $param; |
|
20
|
|
|
|
|
|
|
} else { |
|
21
|
0
|
0
|
|
|
|
|
return ref $param eq 'ARRAY' ? $param : [ $param ]; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Brickyard::Role::Plugin - Role to use for plugins |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package My::App::Plugin::Foo; |
|
34
|
|
|
|
|
|
|
use Role::Basic 'with'; |
|
35
|
|
|
|
|
|
|
with qw(Brickyard Role::Plugin); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 METHODS |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 new |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Constructs a new object. Takes an optional hash of arguments to initialize the |
|
42
|
|
|
|
|
|
|
object. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 brickyard |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Read-write accessor for the L object that created this plugin. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 name |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Read-write accessor for the plugin's name. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 plugins_with |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Delegates to the brickyard object's C method. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 normalize_param |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Utility method to get a parameter value. It returns the parameter with |
|
59
|
|
|
|
|
|
|
the given name so it's ready to be used as a list. It's returned as a |
|
60
|
|
|
|
|
|
|
list in list context and as a reference to a list in scalar context. |