line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Role::FileMunger 6.029; |
2
|
|
|
|
|
|
|
# ABSTRACT: something that alters a file's destination or content |
3
|
|
|
|
|
|
|
|
4
|
15
|
|
|
15
|
|
16850
|
use Moose::Role; |
|
15
|
|
|
|
|
41
|
|
|
15
|
|
|
|
|
154
|
|
5
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::Plugin'; |
6
|
|
|
|
|
|
|
|
7
|
15
|
|
|
15
|
|
80550
|
use Dist::Zilla::Pragmas; |
|
15
|
|
|
|
|
43
|
|
|
15
|
|
|
|
|
108
|
|
8
|
|
|
|
|
|
|
|
9
|
15
|
|
|
15
|
|
137
|
use namespace::autoclean; |
|
15
|
|
|
|
|
74
|
|
|
15
|
|
|
|
|
146
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod A FileMunger has an opportunity to mess around with each file that will be |
14
|
|
|
|
|
|
|
#pod included in the distribution. Each FileMunger's C<munge_files> method is |
15
|
|
|
|
|
|
|
#pod called once. By default, this method will just call the C<munge_file> method |
16
|
|
|
|
|
|
|
#pod (note the missing terminal 's') once for each file, excluding files with an |
17
|
|
|
|
|
|
|
#pod encoding attribute of 'bytes'. |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod The C<munge_file> method is expected to change attributes about the file before |
20
|
|
|
|
|
|
|
#pod it is written out to the built distribution. |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod If you want to modify all files (including ones with an encoding of 'bytes') or |
23
|
|
|
|
|
|
|
#pod want to select a more limited set of files, you can provide your own |
24
|
|
|
|
|
|
|
#pod C<munge_files> method. |
25
|
|
|
|
|
|
|
#pod |
26
|
|
|
|
|
|
|
#pod =cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub munge_files { |
29
|
11
|
|
|
11
|
0
|
3743
|
my ($self) = @_; |
30
|
|
|
|
|
|
|
|
31
|
11
|
50
|
|
|
|
107
|
$self->log_fatal("no munge_file behavior implemented!") |
32
|
|
|
|
|
|
|
unless $self->can('munge_file'); |
33
|
|
|
|
|
|
|
|
34
|
11
|
|
|
|
|
37
|
my @files = @{ $self->zilla->files }; |
|
11
|
|
|
|
|
419
|
|
35
|
11
|
|
|
|
|
47
|
for my $file ( @files ) { |
36
|
99
|
100
|
|
|
|
354
|
if ($file->is_bytes) { |
37
|
9
|
|
|
|
|
57
|
$self->log_debug($file->name . " has 'bytes' encoding, skipping..."); |
38
|
9
|
|
|
|
|
808
|
next; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
90
|
|
|
|
|
311
|
$self->munge_file($file); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=encoding UTF-8 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Dist::Zilla::Role::FileMunger - something that alters a file's destination or content |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 VERSION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
version 6.029 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
A FileMunger has an opportunity to mess around with each file that will be |
64
|
|
|
|
|
|
|
included in the distribution. Each FileMunger's C<munge_files> method is |
65
|
|
|
|
|
|
|
called once. By default, this method will just call the C<munge_file> method |
66
|
|
|
|
|
|
|
(note the missing terminal 's') once for each file, excluding files with an |
67
|
|
|
|
|
|
|
encoding attribute of 'bytes'. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
The C<munge_file> method is expected to change attributes about the file before |
70
|
|
|
|
|
|
|
it is written out to the built distribution. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
If you want to modify all files (including ones with an encoding of 'bytes') or |
73
|
|
|
|
|
|
|
want to select a more limited set of files, you can provide your own |
74
|
|
|
|
|
|
|
C<munge_files> method. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 PERL VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
79
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
80
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
81
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
84
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
85
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
86
|
|
|
|
|
|
|
the minimum required perl. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
97
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |