line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Brickyard::PluginBundle::Filter; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
730
|
use 5.010; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
81
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
6
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
80
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
26
|
use Brickyard::Accessor rw => [qw(bundle remove)]; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
22
|
|
9
|
2
|
|
|
2
|
|
1029
|
use Role::Basic 'with'; |
|
2
|
|
|
|
|
3707
|
|
|
2
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
with 'Brickyard::Role::PluginBundle'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub bundle_config { |
13
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
14
|
1
|
|
|
|
|
3
|
my $package = $self->_exp($self->bundle); |
15
|
1
|
|
|
|
|
51
|
eval "require $package"; |
16
|
1
|
50
|
|
|
|
3
|
die "Cannot require $package: $@" if $@; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# config keys given to this plugin bundle whose name starts with a dash |
19
|
|
|
|
|
|
|
# are intended for the plugin bundle that's being filtered. |
20
|
1
|
|
|
|
|
2
|
my %args; |
21
|
1
|
|
|
|
|
5
|
while (my ($key, $value) = each %$self) { |
22
|
3
|
50
|
|
|
|
12
|
next unless $key =~ s/^-//; |
23
|
0
|
|
|
|
|
0
|
$args{$key} = $value; |
24
|
|
|
|
|
|
|
} |
25
|
1
|
|
|
|
|
3
|
my $bundle_config = |
26
|
|
|
|
|
|
|
$package->new(brickyard => $self->brickyard, %args)->bundle_config; |
27
|
1
|
50
|
|
|
|
12
|
if (my $remove = $self->remove) { |
28
|
1
|
50
|
|
|
|
4
|
$remove = [$remove] unless ref $remove eq 'ARRAY'; |
29
|
1
|
|
|
|
|
4
|
$self->remove_from_config($bundle_config, $remove); |
30
|
|
|
|
|
|
|
} |
31
|
1
|
|
|
|
|
7
|
$bundle_config; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub remove_from_config { |
35
|
3
|
|
|
3
|
1
|
1100
|
my ($self, $bundle_config, $remove) = @_; |
36
|
3
|
|
|
|
|
13
|
for my $i (reverse 0 .. $#$bundle_config) { |
37
|
7
|
100
|
|
|
|
12
|
next unless grep { $bundle_config->[$i][1] eq $_ } @$remove; |
|
7
|
|
|
|
|
37
|
|
38
|
2
|
|
|
|
|
13
|
splice @$bundle_config, $i, 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Brickyard::PluginBundle::Filter - Plugin bundle to filter another plugin bundle |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
In your F: |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
; use [@MyBundle], but replace the [FooBar] plugin with a custom one |
52
|
|
|
|
|
|
|
[*@Filter] |
53
|
|
|
|
|
|
|
bundle = @MyBundle |
54
|
|
|
|
|
|
|
remove = FooBar |
55
|
|
|
|
|
|
|
mybundle_config1 = value1 |
56
|
|
|
|
|
|
|
mybundle_config2 = value2 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
[Better::FooBar] |
59
|
|
|
|
|
|
|
baz = frobnule |
60
|
|
|
|
|
|
|
baz = frobnule2 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This plugin bundle wraps and modifies another plugin bundle. It includes all |
65
|
|
|
|
|
|
|
the configuration for the bundle named in the C attribute, but removes |
66
|
|
|
|
|
|
|
all the entries whose package is given in the C attributes. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Options prefixed with C<-> will be passed to the bundle to be filtered. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 bundle |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Read-write accessor for the name of the bundle that should be filtered. It |
75
|
|
|
|
|
|
|
will be expanded as per L's C method. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 remove |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Read-write accessor for the name(s) of plugins that should be removed from the |
80
|
|
|
|
|
|
|
bundle. These names too will be expanded as per L's |
81
|
|
|
|
|
|
|
C method. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 bundle_config |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Loads the target bundle's configuration, filters the plugins and returns the |
86
|
|
|
|
|
|
|
remaining configuration. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 remove_from_config |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Takes a bundle configuration and a reference to an array of package names that |
91
|
|
|
|
|
|
|
should be removed from the bundle configuration. Returns the filtered |
92
|
|
|
|
|
|
|
configuration. |