line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::Babble::VERSION = '0.002'; |
2
|
|
|
|
|
|
|
use Carp 'croak'; |
3
|
1
|
|
|
1
|
|
2642074
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
4
|
1
|
|
|
1
|
|
5
|
use MooseX::Types::Moose qw/ArrayRef Str/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
5279
|
use MooseX::Types::Perl qw/StrictVersionStr/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
1
|
|
|
1
|
|
4226
|
use List::Util 'any'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
1818
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
491
|
|
8
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::FileMunger', |
9
|
|
|
|
|
|
|
'Dist::Zilla::Role::FileFinderUser' => { |
10
|
|
|
|
|
|
|
default_finders => [ ':InstallModules', ':ExecFiles' ], |
11
|
|
|
|
|
|
|
}; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
return qw/files plugins/; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
return { |
17
|
|
|
|
|
|
|
file => 'files', |
18
|
|
|
|
|
|
|
plugin => 'plugins', |
19
|
|
|
|
|
|
|
}; |
20
|
2
|
|
|
2
|
0
|
297
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has files => ( |
23
|
|
|
|
|
|
|
isa => ArrayRef[Str], |
24
|
|
|
|
|
|
|
traits => ['Array'], |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
default => sub { [] }, |
27
|
|
|
|
|
|
|
handles => { |
28
|
|
|
|
|
|
|
files => 'elements', |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has plugins => ( |
33
|
|
|
|
|
|
|
isa => ArrayRef[Str], |
34
|
|
|
|
|
|
|
traits => ['Array'], |
35
|
|
|
|
|
|
|
lazy => 1, |
36
|
|
|
|
|
|
|
builder => '_build_plugins', |
37
|
|
|
|
|
|
|
handles => { |
38
|
|
|
|
|
|
|
plugins => 'elements', |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my %supported_since = ( |
43
|
|
|
|
|
|
|
'::CoreSignatures' => '5.028', |
44
|
|
|
|
|
|
|
'::State' => '5.010', |
45
|
|
|
|
|
|
|
'::DefinedOr' => '5.010', |
46
|
|
|
|
|
|
|
'::PostfixDeref' => '5.020', |
47
|
|
|
|
|
|
|
'::SubstituteAndReturn' => '5.014', |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
my @plugins = grep { $supported_since{$_} > $self->for_version } keys %supported_since; |
52
|
|
|
|
|
|
|
return \@plugins; |
53
|
|
|
|
|
|
|
} |
54
|
1
|
|
|
1
|
|
3
|
|
55
|
1
|
|
|
|
|
5
|
has for_version => ( |
|
5
|
|
|
|
|
160
|
|
56
|
1
|
|
|
|
|
33
|
is => 'ro', |
57
|
|
|
|
|
|
|
isa => StrictVersionStr, |
58
|
|
|
|
|
|
|
default => '5.008', |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has transformer => ( |
62
|
|
|
|
|
|
|
is => 'ro', |
63
|
|
|
|
|
|
|
init_arg => undef, |
64
|
|
|
|
|
|
|
lazy => 1, |
65
|
|
|
|
|
|
|
builder => '_build_transformer', |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $self = shift; |
69
|
|
|
|
|
|
|
require Babble::PluginChain; |
70
|
|
|
|
|
|
|
my $pc = Babble::PluginChain->new; |
71
|
|
|
|
|
|
|
$pc->add_plugin($_) for $self->plugins; |
72
|
|
|
|
|
|
|
return $pc; |
73
|
2
|
|
|
2
|
|
4
|
} |
74
|
2
|
|
|
|
|
409
|
|
75
|
2
|
|
|
|
|
54530
|
my $self = shift; |
76
|
2
|
|
|
|
|
982
|
|
77
|
2
|
|
|
|
|
18987
|
if (my %filename = map { $_ => 1 } $self->files) { |
78
|
|
|
|
|
|
|
foreach my $file (@{ $self->zilla->files }) { |
79
|
|
|
|
|
|
|
$self->munge_file($file) if $filename{$file->name}; |
80
|
|
|
|
|
|
|
} |
81
|
2
|
|
|
2
|
0
|
67920
|
} |
82
|
|
|
|
|
|
|
else { |
83
|
2
|
50
|
|
|
|
69
|
$self->munge_file($_) for @{ $self->found_files }; |
|
0
|
|
|
|
|
0
|
|
84
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
85
|
0
|
0
|
|
|
|
0
|
|
86
|
|
|
|
|
|
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
2
|
|
|
|
|
4
|
my ($self, $file) = @_; |
|
2
|
|
|
|
|
6
|
|
90
|
|
|
|
|
|
|
my $content = $file->content; |
91
|
|
|
|
|
|
|
my $pc = $self->transformer; |
92
|
2
|
|
|
|
|
11
|
eval { |
93
|
|
|
|
|
|
|
$file->content($pc->transform_document($content)); |
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
} or croak 'Could not munge ' . $file->name . ': ' . $@; |
96
|
2
|
|
|
2
|
0
|
2492
|
return; |
97
|
2
|
|
|
|
|
7
|
} |
98
|
2
|
|
|
|
|
1539
|
|
99
|
2
|
50
|
|
|
|
3
|
__PACKAGE__->meta->make_immutable; |
100
|
2
|
|
|
|
|
6
|
no Moose; |
101
|
2
|
|
|
|
|
2013764
|
|
102
|
|
|
|
|
|
|
'For Science®'; |
103
|
2
|
|
|
|
|
10
|
|
104
|
|
|
|
|
|
|
# ABSTRACT: EXPERIMENTAL Automatic Babble substitution in Dist::Zilla |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
1
|
|
8
|
# vim: ts=4 sts=4 sw=4 noet : |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=pod |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=encoding UTF-8 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Babble - EXPERIMENTAL Automatic Babble substitution in Dist::Zilla |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 VERSION |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
version 0.002 |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 SYNOPSIS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
[Babble] |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
#or |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
[Babble] |
129
|
|
|
|
|
|
|
for_version = 5.010 # don't translate defined-or or state |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#or |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
[Babble] |
134
|
|
|
|
|
|
|
plugin = ::CoreSignatures # only signature transformation |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 DESCRIPTION |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Are you in need of Damian's Mad Science™? Are you lacking Matt's Voodoo? Do you want to mix all of the complexities of dzil's transformations with that stack? Then you're in the right place. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This module translates various modern Perl langauge features into their older equivalents using L<Babble|Babble>. It is highly experimental, and comes with no warranties whatsoever. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
By default it transforms code to be able to compile on perl C<5.008>. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 AUTHOR |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Leon Timmermans. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
153
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |