line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
26
|
use 5.14.0; |
|
2
|
|
|
|
|
7
|
|
2
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
41
|
|
3
|
2
|
|
|
2
|
|
21
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
135
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Dist::Iller::Plugin; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
8
|
|
|
|
|
|
|
# ABSTRACT: Handle a Dist::Zilla/Pod::Weaver plugin |
9
|
|
|
|
|
|
|
our $VERSION = '0.1411'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
15
|
use Dist::Iller::Elk; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
18
|
|
12
|
2
|
|
|
2
|
|
4191
|
use Types::Standard qw/Str Enum HashRef/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
14
|
|
13
|
2
|
|
|
2
|
|
1583
|
use List::MoreUtils qw/uniq/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
20
|
|
14
|
2
|
|
|
2
|
|
3333
|
use MooseX::StrictConstructor; |
|
2
|
|
|
|
|
32927
|
|
|
2
|
|
|
|
|
9
|
|
15
|
2
|
|
|
2
|
|
17974
|
use Dist::Iller::Prereq; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1727
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
with qw/ |
18
|
|
|
|
|
|
|
Dist::Iller::Role::HasPrereqs |
19
|
|
|
|
|
|
|
/; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has plugin_name => ( |
22
|
|
|
|
|
|
|
is => 'ro', |
23
|
|
|
|
|
|
|
isa => Str, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
has base => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => Str, |
28
|
|
|
|
|
|
|
predicate => 1, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
has in => ( |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
isa => Enum[qw/Plugin PluginBundle Section Elemental/], |
33
|
|
|
|
|
|
|
default => 'Plugin', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
has version => ( |
36
|
|
|
|
|
|
|
is => 'rw', |
37
|
|
|
|
|
|
|
isa => Str, |
38
|
|
|
|
|
|
|
default => '0', |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
has documentation => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => Str, |
43
|
|
|
|
|
|
|
predicate => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
has parameters => ( |
46
|
|
|
|
|
|
|
is => 'ro', |
47
|
|
|
|
|
|
|
isa => HashRef, |
48
|
|
|
|
|
|
|
traits => [qw/Hash/], |
49
|
|
|
|
|
|
|
handles => { |
50
|
|
|
|
|
|
|
set_parameter => 'set', |
51
|
|
|
|
|
|
|
get_parameter => 'get', |
52
|
|
|
|
|
|
|
parameter_keys => 'keys', |
53
|
|
|
|
|
|
|
delete_parameter => 'delete', |
54
|
|
|
|
|
|
|
parameters_kv => 'kv', |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
around BUILDARGS => sub { |
59
|
|
|
|
|
|
|
my $next = shift; |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
my $args = ref $_[0] eq 'HASH' ? shift : { @_ }; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
if(exists $args->{'prereqs'}) { |
64
|
|
|
|
|
|
|
my $prereqs = []; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
for my $prereq (@{ $args->{'prereqs'} }) { |
67
|
|
|
|
|
|
|
my($phase, $relation) = split /_/ => (keys %{ $prereq })[0]; |
68
|
|
|
|
|
|
|
my($module, $version) = split / / => (values %{ $prereq })[0]; |
69
|
|
|
|
|
|
|
$version ||= 0; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
push @{ $prereqs } => Dist::Iller::Prereq->new( |
72
|
|
|
|
|
|
|
phase => $phase, |
73
|
|
|
|
|
|
|
relation => $relation, |
74
|
|
|
|
|
|
|
module => $module, |
75
|
|
|
|
|
|
|
version => $version, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
$args->{'prereqs'} = $prereqs; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
$self->$next($args); |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub merge_with { |
85
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
86
|
1
|
|
|
|
|
3
|
my $other_plugin = shift; |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
|
|
|
38
|
foreach my $param ($other_plugin->parameter_keys) { |
89
|
2
|
50
|
|
|
|
81
|
if($self->get_parameter($param)) { |
90
|
2
|
100
|
|
|
|
80
|
if(ref $other_plugin->get_parameter($param) eq 'ARRAY') { |
91
|
1
|
50
|
|
|
|
34
|
if(ref $self->get_parameter($param) eq 'ARRAY') { |
92
|
1
|
|
|
|
|
2
|
my $new_param_data = [ uniq @{ $self->get_parameter($param) }, @{ $other_plugin->get_parameter($param) } ]; |
|
1
|
|
|
|
|
33
|
|
|
1
|
|
|
|
|
34
|
|
93
|
1
|
|
|
|
|
44
|
$self->set_parameter($param, $new_param_data); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
else { |
96
|
0
|
|
|
|
|
0
|
my $new_param_data = [ uniq ($self->get_parameter($param)), @{ $other_plugin->get_parameter($param) } ]; |
|
0
|
|
|
|
|
0
|
|
97
|
0
|
|
|
|
|
0
|
$self->set_parameter($param, $new_param_data); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
else { |
101
|
1
|
|
|
|
|
46
|
$self->set_parameter($param, $other_plugin->get_parameter($param)); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
else { |
105
|
0
|
|
|
|
|
0
|
$self->set_parameter($param, $other_plugin->get_parameter($param)); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub to_string { |
111
|
71
|
|
|
71
|
0
|
108
|
my $self = shift; |
112
|
71
|
|
|
|
|
121
|
my %options = @_; |
113
|
|
|
|
|
|
|
|
114
|
71
|
100
|
|
|
|
2012
|
my @strings = $self->has_base ? (sprintf '[%s / %s]' => $self->base, $self->plugin_name) |
115
|
|
|
|
|
|
|
: (sprintf '[%s]' => $self->plugin_name) |
116
|
|
|
|
|
|
|
; |
117
|
|
|
|
|
|
|
|
118
|
71
|
|
|
|
|
2386
|
foreach my $parameter (sort $self->parameter_keys) { |
119
|
91
|
100
|
|
|
|
245
|
next if $parameter =~ m{^\+}; |
120
|
89
|
|
|
|
|
2992
|
my $value = $self->get_parameter($parameter); |
121
|
|
|
|
|
|
|
|
122
|
89
|
100
|
|
|
|
181
|
if(ref $value eq 'ARRAY') { |
123
|
13
|
|
|
|
|
38
|
foreach my $val (@$value) { |
124
|
14
|
50
|
|
|
|
80
|
push @strings => sprintf '%s =%s%s', $parameter, defined $val ? ' ' : '', defined $val ? $val : ''; |
|
|
50
|
|
|
|
|
|
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
else { |
128
|
76
|
50
|
|
|
|
422
|
push @strings => sprintf '%s =%s%s', $parameter, defined $value ? ' ' : '', defined $value ? $value : ''; |
|
|
50
|
|
|
|
|
|
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
71
|
|
|
|
|
346
|
return join "\n" => @strings; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
__END__ |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=pod |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=encoding UTF-8 |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 NAME |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Dist::Iller::Plugin - Handle a Dist::Zilla/Pod::Weaver plugin |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 VERSION |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Version 0.1411, released 2020-01-01. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 SOURCE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Dist-Iller> |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 HOMEPAGE |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
L<https://metacpan.org/release/Dist-Iller> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 AUTHOR |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Erik Carlsson. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
170
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=cut |