line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: random snippets of code that Dist::Zilla wants |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Dist::Zilla::Pragmas; |
4
|
54
|
|
|
54
|
|
82942
|
|
|
54
|
|
|
|
|
127
|
|
|
54
|
|
|
|
|
406
|
|
5
|
|
|
|
|
|
|
use Carp (); |
6
|
54
|
|
|
54
|
|
411
|
use Encode (); |
|
54
|
|
|
|
|
118
|
|
|
54
|
|
|
|
|
873
|
|
7
|
54
|
|
|
54
|
|
1914
|
|
|
54
|
|
|
|
|
41938
|
|
|
54
|
|
|
|
|
939
|
|
8
|
|
|
|
|
|
|
use namespace::autoclean; |
9
|
54
|
|
|
54
|
|
1212
|
|
|
54
|
|
|
|
|
33280
|
|
|
54
|
|
|
|
|
407
|
|
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
package |
12
|
|
|
|
|
|
|
Dist::Zilla::Util::PEA; |
13
|
|
|
|
|
|
|
@Dist::Zilla::Util::PEA::ISA = ('Pod::Simple'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my ($class, @args) = @_; |
16
|
|
|
|
|
|
|
require Pod::Simple; |
17
|
14
|
|
|
14
|
|
3299
|
my $parser = $class->new(@args); |
18
|
14
|
|
|
|
|
6349
|
$parser->code_handler(sub { |
19
|
14
|
|
|
|
|
246599
|
my ($line, $line_number, $parser) = @_; |
20
|
|
|
|
|
|
|
return if $parser->{abstract}; |
21
|
131
|
|
|
131
|
|
5456
|
|
22
|
131
|
100
|
|
|
|
294
|
|
23
|
|
|
|
|
|
|
return $parser->{abstract} = $1 |
24
|
|
|
|
|
|
|
if $line =~ /^\s*#+\s*ABSTRACT:[ \t]*(\S.*)$/m; |
25
|
43
|
100
|
|
|
|
178
|
return; |
26
|
|
|
|
|
|
|
}); |
27
|
36
|
|
|
|
|
76
|
return $parser; |
28
|
14
|
|
|
|
|
392
|
} |
29
|
14
|
|
|
|
|
177
|
|
30
|
|
|
|
|
|
|
my ($parser, $ele_name, $attr) = @_; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ($ele_name eq 'head1') { |
33
|
61
|
|
|
61
|
|
11888
|
$parser->{buffer} = ""; |
34
|
|
|
|
|
|
|
} |
35
|
61
|
100
|
|
|
|
218
|
elsif ($ele_name eq 'Para') { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
36
|
19
|
|
|
|
|
35
|
$parser->{buffer} = ""; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
elsif ($ele_name eq 'C') { |
39
|
17
|
|
|
|
|
31
|
$parser->{in_C} = 1; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
11
|
return; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
61
|
|
|
|
|
112
|
my ($parser, $ele_name, $attr) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return if $parser->{abstract}; |
48
|
|
|
|
|
|
|
if ($ele_name eq 'head1') { |
49
|
61
|
|
|
61
|
|
794
|
$parser->{in_section} = $parser->{buffer}; |
50
|
|
|
|
|
|
|
} |
51
|
61
|
100
|
|
|
|
154
|
elsif ($ele_name eq 'Para' && $parser->{in_section} eq 'NAME' ) { |
52
|
15
|
100
|
66
|
|
|
80
|
if ($parser->{buffer} =~ /^(?:\S+\s+)+?-+\s+(.+)$/s) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
53
|
7
|
|
|
|
|
19
|
$parser->{abstract} = $1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
7
|
50
|
|
|
|
49
|
elsif ($ele_name eq 'C') { |
57
|
7
|
|
|
|
|
23
|
delete $parser->{in_C}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return; |
61
|
1
|
|
|
|
|
2
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my ($parser, $text) = @_; |
64
|
15
|
|
|
|
|
30
|
|
65
|
|
|
|
|
|
|
# The C<...> tags are expected to be preserved. MetaCPAN renders them. |
66
|
|
|
|
|
|
|
if ($parser->{in_C}) { |
67
|
|
|
|
|
|
|
$parser->{buffer} .= "C<$text>"; |
68
|
49
|
|
|
49
|
|
411
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
|
|
|
|
|
|
$parser->{buffer} .= $text; |
71
|
49
|
100
|
|
|
|
109
|
} |
72
|
9
|
|
|
|
|
28
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
40
|
|
|
|
|
72
|
|
76
|
|
|
|
|
|
|
#pod =method abstract_from_file |
77
|
49
|
|
|
|
|
88
|
#pod |
78
|
|
|
|
|
|
|
#pod This method, I<which is likely to change or go away>, tries to guess the |
79
|
|
|
|
|
|
|
#pod abstract of a given file, assuming that it's Perl code. It looks for a POD |
80
|
|
|
|
|
|
|
#pod C<=head1> section called "NAME" or a comment beginning with C<ABSTRACT:>. |
81
|
|
|
|
|
|
|
#pod |
82
|
|
|
|
|
|
|
#pod =cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my ($self, $file) = @_; |
85
|
|
|
|
|
|
|
my $e = Dist::Zilla::Util::PEA->_new; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
$e->parse_string_document($file->content); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
return $e->{abstract}; |
90
|
8
|
|
|
8
|
1
|
36
|
} |
91
|
8
|
|
|
|
|
76
|
|
92
|
|
|
|
|
|
|
#pod =method expand_config_package_name |
93
|
8
|
|
|
|
|
77
|
#pod |
94
|
|
|
|
|
|
|
#pod my $pkg_name = Dist::Zilla::Util->expand_config_package_name($string); |
95
|
8
|
|
|
|
|
232
|
#pod |
96
|
|
|
|
|
|
|
#pod This method, I<which is likely to change or go away>, rewrites the given string |
97
|
|
|
|
|
|
|
#pod into a package name. |
98
|
|
|
|
|
|
|
#pod |
99
|
|
|
|
|
|
|
#pod Prefixes are rewritten as follows: |
100
|
|
|
|
|
|
|
#pod |
101
|
|
|
|
|
|
|
#pod =for :list |
102
|
|
|
|
|
|
|
#pod * C<=> becomes nothing |
103
|
|
|
|
|
|
|
#pod * C<@> becomes C<Dist::Zilla::PluginBundle::> |
104
|
|
|
|
|
|
|
#pod * C<%> becomes C<Dist::Zilla::Stash::> |
105
|
|
|
|
|
|
|
#pod * otherwise, C<Dist::Zilla::Plugin::> is prepended |
106
|
|
|
|
|
|
|
#pod |
107
|
|
|
|
|
|
|
#pod =cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
use String::RewritePrefix 0.006 rewrite => { |
110
|
|
|
|
|
|
|
-as => '_expand_config_package_name', |
111
|
|
|
|
|
|
|
prefixes => { |
112
|
|
|
|
|
|
|
'=' => '', |
113
|
|
|
|
|
|
|
'@' => 'Dist::Zilla::PluginBundle::', |
114
|
|
|
|
|
|
|
'%' => 'Dist::Zilla::Stash::', |
115
|
54
|
|
|
|
|
718
|
'' => 'Dist::Zilla::Plugin::', |
116
|
|
|
|
|
|
|
}, |
117
|
|
|
|
|
|
|
}; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
shift; goto &_expand_config_package_name |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$^O eq 'MSWin32' && "$]" < 5.016 ? $ENV{HOME} || $ENV{USERPROFILE} : (glob('~'))[0]; |
123
|
54
|
|
|
54
|
|
47969
|
} |
|
54
|
|
|
|
|
27394
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
require Dist::Zilla::Path; |
126
|
688
|
|
|
688
|
1
|
1472
|
return Dist::Zilla::Path::path($ENV{DZIL_GLOBAL_CONFIG_ROOT}) if $ENV{DZIL_GLOBAL_CONFIG_ROOT}; |
|
688
|
|
|
|
|
3710
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my $homedir = homedir(); |
129
|
|
|
|
|
|
|
Carp::croak("couldn't determine home directory") if not $homedir; |
130
|
0
|
0
|
0
|
0
|
0
|
0
|
|
|
|
|
0
|
|
|
|
|
131
|
|
|
|
|
|
|
return Dist::Zilla::Path::path($homedir)->child('.dzil'); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
1
|
|
|
1
|
|
7
|
my ($self, $pkg, $version) = @_; |
135
|
1
|
50
|
|
|
|
10
|
|
136
|
|
|
|
|
|
|
require CPAN::Meta::Requirements; |
137
|
0
|
|
|
|
|
0
|
my $req = CPAN::Meta::Requirements->from_string_hash({ |
138
|
0
|
0
|
|
|
|
0
|
$pkg => $version, |
139
|
|
|
|
|
|
|
}); |
140
|
0
|
|
|
|
|
0
|
|
141
|
|
|
|
|
|
|
my $have_version = $pkg->VERSION; |
142
|
|
|
|
|
|
|
unless ($req->accepts_module($pkg => $have_version)) { |
143
|
|
|
|
|
|
|
die( sprintf |
144
|
2
|
|
|
2
|
|
31
|
"%s version (%s) does not match required version: %s\n", |
145
|
|
|
|
|
|
|
$pkg, |
146
|
2
|
|
|
|
|
14
|
$have_version // 'undef', |
147
|
2
|
|
|
|
|
27
|
$version, |
148
|
|
|
|
|
|
|
); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
} |
151
|
2
|
|
|
|
|
592
|
|
152
|
2
|
100
|
|
|
|
13
|
1; |
153
|
1
|
|
50
|
|
|
143
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=pod |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=encoding UTF-8 |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 NAME |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Dist::Zilla::Util - random snippets of code that Dist::Zilla wants |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 VERSION |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
version 6.028 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 PERL VERSION |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
170
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
171
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
172
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
175
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
176
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
177
|
|
|
|
|
|
|
the minimum required perl. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 METHODS |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head2 abstract_from_file |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This method, I<which is likely to change or go away>, tries to guess the |
184
|
|
|
|
|
|
|
abstract of a given file, assuming that it's Perl code. It looks for a POD |
185
|
|
|
|
|
|
|
C<=head1> section called "NAME" or a comment beginning with C<ABSTRACT:>. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 expand_config_package_name |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
my $pkg_name = Dist::Zilla::Util->expand_config_package_name($string); |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This method, I<which is likely to change or go away>, rewrites the given string |
192
|
|
|
|
|
|
|
into a package name. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Prefixes are rewritten as follows: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over 4 |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item * |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
C<=> becomes nothing |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
C<@> becomes C<Dist::Zilla::PluginBundle::> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
C<%> becomes C<Dist::Zilla::Stash::> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item * |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
otherwise, C<Dist::Zilla::Plugin::> is prepended |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=back |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head1 AUTHOR |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
225
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=cut |