line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Author::Plicease::Thanks 2.40 { |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2588652
|
use 5.014; |
|
2
|
|
|
|
|
8
|
|
4
|
2
|
|
|
2
|
|
11
|
use Moose; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
15
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::MetaProvider'; |
7
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger'; |
8
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileFinderUser' => { |
9
|
|
|
|
|
|
|
default_finders => [ ':InstallModules', ':ExecFiles' ], |
10
|
|
|
|
|
|
|
}; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: munge the AUTHOR section |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has original => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => 'Str', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has current => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => 'Str', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has contributor => ( |
26
|
|
|
|
|
|
|
is => 'ro', |
27
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
28
|
|
|
|
|
|
|
default => sub { [] }, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub mvp_multivalue_args { qw( contributor ) } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub munge_files |
34
|
|
|
|
|
|
|
{ |
35
|
4
|
|
|
4
|
0
|
93610
|
my($self) = @_; |
36
|
4
|
|
|
|
|
8
|
$self->munge_file($_) for @{ $self->found_files }; |
|
4
|
|
|
|
|
16
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _escape ($) |
40
|
|
|
|
|
|
|
{ |
41
|
12
|
|
|
12
|
|
23
|
my($txt) = @_; |
42
|
12
|
|
|
|
|
29
|
my %map = qw( |
43
|
|
|
|
|
|
|
< lt |
44
|
|
|
|
|
|
|
> gt |
45
|
|
|
|
|
|
|
); |
46
|
12
|
|
|
|
|
25
|
$txt =~ s{([<>])}{E<$map{$1}>}g; |
47
|
12
|
|
|
|
|
100
|
$txt; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub munge_file |
51
|
|
|
|
|
|
|
{ |
52
|
4
|
|
|
4
|
0
|
5147
|
my($self, $file) = @_; |
53
|
|
|
|
|
|
|
|
54
|
4
|
50
|
|
|
|
129
|
$self->log_fatal('requires at least current') |
55
|
|
|
|
|
|
|
unless $self->current; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $replacer = sub { |
58
|
4
|
|
|
4
|
|
8
|
my @list; |
59
|
4
|
|
|
|
|
10
|
push @list, '=head1 AUTHOR', ''; |
60
|
4
|
100
|
|
|
|
130
|
if($self->original) |
61
|
|
|
|
|
|
|
{ |
62
|
2
|
|
|
|
|
115
|
push @list, 'Original author: ' . _escape $self->original, |
63
|
|
|
|
|
|
|
'', |
64
|
|
|
|
|
|
|
'Current maintainer: ' . _escape $self->current, |
65
|
|
|
|
|
|
|
''; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else |
68
|
|
|
|
|
|
|
{ |
69
|
2
|
|
|
|
|
59
|
push @list, 'Author: ' . _escape $self->current, |
70
|
|
|
|
|
|
|
''; |
71
|
|
|
|
|
|
|
} |
72
|
4
|
100
|
|
|
|
8
|
if(@{ $self->contributor } > 0) |
|
4
|
|
|
|
|
125
|
|
73
|
|
|
|
|
|
|
{ |
74
|
2
|
|
|
|
|
4
|
push @list, 'Contributors:', '', map { (_escape $_, '') } @{ $self->contributor }; |
|
6
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
58
|
|
75
|
|
|
|
|
|
|
} |
76
|
4
|
|
|
|
|
39
|
return join "\n", @list, ''; |
77
|
4
|
|
|
|
|
20
|
}; |
78
|
|
|
|
|
|
|
|
79
|
4
|
|
|
|
|
21
|
my $content = $file->content; |
80
|
4
|
50
|
|
|
|
2955
|
unless($content =~ s{^=head1 AUTHOR.*(=head1 COPYRIGHT)}{$replacer->() . $1}sem) |
|
4
|
|
|
|
|
11
|
|
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
|
|
0
|
$self->log_fatal('could not replace AUTHOR section'); |
83
|
|
|
|
|
|
|
} |
84
|
4
|
|
|
|
|
22
|
$file->content($content); |
85
|
|
|
|
|
|
|
|
86
|
4
|
|
|
|
|
882
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub metadata |
90
|
|
|
|
|
|
|
{ |
91
|
4
|
|
|
4
|
0
|
25527
|
my ($self) = @_; |
92
|
|
|
|
|
|
|
|
93
|
4
|
|
|
|
|
7
|
my @contributors = @{$self->contributor}; |
|
4
|
|
|
|
|
138
|
|
94
|
4
|
50
|
|
|
|
120
|
unshift @contributors, $self->current if $self->current; |
95
|
4
|
100
|
|
|
|
118
|
unshift @contributors, $self->original if $self->original; |
96
|
|
|
|
|
|
|
|
97
|
4
|
|
|
|
|
19
|
return +{ x_contributors => \@contributors }; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=pod |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=encoding UTF-8 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 NAME |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Author::Plicease::Thanks - munge the AUTHOR section |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 VERSION |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
version 2.40 |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SYNOPSIS |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
[Author::Plicease::Thanks] |
123
|
|
|
|
|
|
|
original = Original Author |
124
|
|
|
|
|
|
|
current = Current Maintainer |
125
|
|
|
|
|
|
|
contributor = Contributor One |
126
|
|
|
|
|
|
|
contributor = Contributor Two |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SEE ALSO |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=over 4 |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item L<Dist::Zilla> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item L<Dist::Zilla::PluginBundle::Author::Plicease> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=back |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 AUTHOR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Graham Ollis <plicease@cpan.org> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Graham Ollis. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
147
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |