line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Utils for listing your distribution's author dependencies |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use Dist::Zilla::Pragmas; |
4
|
2
|
|
|
2
|
|
141539
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
use Dist::Zilla::Util; |
6
|
2
|
|
|
2
|
|
496
|
use Path::Tiny; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
62
|
|
7
|
2
|
|
|
2
|
|
2683
|
use List::Util 1.45 (); |
|
2
|
|
|
|
|
13534
|
|
|
2
|
|
|
|
|
135
|
|
8
|
2
|
|
|
2
|
|
15
|
|
|
2
|
|
|
|
|
41
|
|
|
2
|
|
|
|
|
46
|
|
9
|
|
|
|
|
|
|
use namespace::autoclean; |
10
|
2
|
|
|
2
|
|
11
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
11
|
|
|
|
|
|
|
my ($reqs, $versions) = @_; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
0
|
0
|
my $formatted = ''; |
14
|
|
|
|
|
|
|
foreach my $rec (@{ $reqs }) { |
15
|
0
|
|
|
|
|
0
|
my ($mod, $ver) = each(%{ $rec }); |
16
|
0
|
|
|
|
|
0
|
$formatted .= $versions ? "$mod = $ver\n" : "$mod\n"; |
|
0
|
|
|
|
|
0
|
|
17
|
0
|
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
18
|
0
|
0
|
|
|
|
0
|
chomp($formatted); |
19
|
|
|
|
|
|
|
return $formatted; |
20
|
0
|
|
|
|
|
0
|
} |
21
|
0
|
|
|
|
|
0
|
|
22
|
|
|
|
|
|
|
my ($root, $missing) = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $ini = path($root, 'dist.ini'); |
25
|
2
|
|
|
2
|
0
|
173
|
|
26
|
|
|
|
|
|
|
die "dzil authordeps only works on dist.ini files, and you don't have one\n" |
27
|
2
|
|
|
|
|
13
|
unless -e $ini; |
28
|
|
|
|
|
|
|
|
29
|
2
|
50
|
|
|
|
185
|
my $fh = $ini->openr_utf8; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
require Config::INI::Reader; |
32
|
2
|
|
|
|
|
136
|
my $config = Config::INI::Reader->read_handle($fh); |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
2820
|
require CPAN::Meta::Requirements; |
35
|
2
|
|
|
|
|
35430
|
my $reqs = CPAN::Meta::Requirements->new; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
5822
|
if (defined (my $license = $config->{_}->{license})) { |
38
|
2
|
|
|
|
|
3717
|
$license = 'Software::License::'.$license; |
39
|
|
|
|
|
|
|
$reqs->add_minimum($license => 0); |
40
|
2
|
50
|
|
|
|
55
|
} |
41
|
2
|
|
|
|
|
8
|
|
42
|
2
|
|
|
|
|
11
|
for my $section ( sort keys %$config ) { |
43
|
|
|
|
|
|
|
if (q[_] eq $section) { |
44
|
|
|
|
|
|
|
my $version = $config->{_}{':version'}; |
45
|
2
|
|
|
|
|
123
|
$reqs->add_minimum('Dist::Zilla' => $version) if $version; |
46
|
14
|
100
|
|
|
|
704
|
next; |
47
|
2
|
|
|
|
|
7
|
} |
48
|
2
|
50
|
|
|
|
11
|
|
49
|
2
|
|
|
|
|
185
|
my $pack = $section; |
50
|
|
|
|
|
|
|
$pack =~ s{\s*/.*$}{}; # trim optional space and slash-delimited suffix |
51
|
|
|
|
|
|
|
|
52
|
12
|
|
|
|
|
22
|
my $version = 0; |
53
|
12
|
|
|
|
|
47
|
$version = $config->{$section}->{':version'} if exists $config->{$section}->{':version'}; |
54
|
|
|
|
|
|
|
|
55
|
12
|
|
|
|
|
22
|
my $realname = Dist::Zilla::Util->expand_config_package_name($pack); |
56
|
12
|
100
|
|
|
|
40
|
$reqs->add_minimum($realname => $version); |
57
|
|
|
|
|
|
|
} |
58
|
12
|
|
|
|
|
46
|
|
59
|
12
|
|
|
|
|
350
|
seek $fh, 0, 0; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $in_filter = 0; |
62
|
2
|
|
|
|
|
23
|
while (<$fh>) { |
63
|
|
|
|
|
|
|
next unless $in_filter or /^\[\s*\@Filter/; |
64
|
2
|
|
|
|
|
9
|
$in_filter = 0, next if /^\[/ and ! /^\[\s*\@Filter/; |
65
|
2
|
|
|
|
|
42
|
$in_filter = 1; |
66
|
58
|
50
|
33
|
|
|
225
|
|
67
|
0
|
0
|
0
|
|
|
0
|
next unless /\A-bundle\s*=\s*([^;\s]+)/; |
68
|
0
|
|
|
|
|
0
|
my $pname = $1; |
69
|
|
|
|
|
|
|
chomp($pname); |
70
|
0
|
0
|
|
|
|
0
|
$reqs->add_minimum(Dist::Zilla::Util->expand_config_package_name($1) => 0) |
71
|
0
|
|
|
|
|
0
|
} |
72
|
0
|
|
|
|
|
0
|
|
73
|
0
|
|
|
|
|
0
|
seek $fh, 0, 0; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my @packages; |
76
|
2
|
|
|
|
|
17
|
while (<$fh>) { |
77
|
|
|
|
|
|
|
chomp; |
78
|
2
|
|
|
|
|
6
|
next unless /\A\s*;\s*authordep\s*(\S+)\s*(?:=\s*([^;]+))?\s*/; |
79
|
2
|
|
|
|
|
24
|
my $module = $1; |
80
|
58
|
|
|
|
|
783
|
my $ver = $2 // "0"; |
81
|
58
|
100
|
|
|
|
198
|
$ver =~ s/\s+$//; |
82
|
6
|
|
|
|
|
20
|
# Any "; authordep " is inserted at the beginning of the list |
83
|
6
|
|
50
|
|
|
20
|
# in the file order so the user can control the order of at least a part of |
84
|
6
|
|
|
|
|
28
|
# the plugin list |
85
|
|
|
|
|
|
|
push @packages, $module; |
86
|
|
|
|
|
|
|
# And added to the requirements so we can use it later |
87
|
|
|
|
|
|
|
$reqs->add_string_requirement($module => $ver); |
88
|
6
|
|
|
|
|
13
|
} |
89
|
|
|
|
|
|
|
|
90
|
6
|
|
|
|
|
19
|
my $vermap = $reqs->as_string_hash; |
91
|
|
|
|
|
|
|
# Add the other requirements |
92
|
|
|
|
|
|
|
push(@packages, sort keys %{ $vermap }); |
93
|
2
|
|
|
|
|
12
|
|
94
|
|
|
|
|
|
|
# Move inc:: first in list as they may impact the loading of other |
95
|
2
|
|
|
|
|
741
|
# plugins (in particular local ones). |
|
2
|
|
|
|
|
22
|
|
96
|
|
|
|
|
|
|
# Also order inc:: so that those that want to hack @INC with inc:: plugins |
97
|
|
|
|
|
|
|
# can have a consistent playground. |
98
|
|
|
|
|
|
|
# We don't sort the others packages to preserve the same (random) ordering |
99
|
|
|
|
|
|
|
# for the common case (no inc::, no '; authordep') as in previous dzil |
100
|
|
|
|
|
|
|
# releases. |
101
|
|
|
|
|
|
|
@packages = ((sort grep /^inc::/, @packages), (grep !/^inc::/, @packages)); |
102
|
|
|
|
|
|
|
@packages = List::Util::uniq(@packages); |
103
|
|
|
|
|
|
|
|
104
|
2
|
|
|
|
|
34
|
if ($missing) { |
105
|
2
|
|
|
|
|
26
|
require Module::Runtime; |
106
|
|
|
|
|
|
|
|
107
|
2
|
100
|
|
|
|
13
|
@packages = |
108
|
1
|
|
|
|
|
9
|
grep { |
109
|
|
|
|
|
|
|
$_ eq 'perl' |
110
|
|
|
|
|
|
|
? ! ($vermap->{perl} && eval "use $vermap->{perl}; 1") |
111
|
|
|
|
|
|
|
: do { |
112
|
1
|
|
|
|
|
4
|
my $m = $_; |
113
|
|
|
|
|
|
|
! eval { |
114
|
1
|
100
|
33
|
1
|
|
20
|
local @INC = @INC; push @INC, $root; |
|
1
|
|
|
|
|
4
|
|
|
11
|
|
|
|
|
454
|
|
115
|
10
|
|
|
|
|
25
|
# This will die if module is missing |
116
|
10
|
|
|
|
|
18
|
Module::Runtime::require_module($m); |
117
|
10
|
|
|
|
|
59
|
my $v = $vermap->{$m}; |
|
10
|
|
|
|
|
33
|
|
118
|
|
|
|
|
|
|
# This will die if VERSION is too low |
119
|
10
|
|
|
|
|
36
|
!$v || $m->VERSION($v); |
120
|
9
|
|
|
|
|
4052
|
# Success! |
121
|
|
|
|
|
|
|
1 |
122
|
9
|
100
|
|
|
|
106
|
} |
123
|
|
|
|
|
|
|
} |
124
|
9
|
|
|
|
|
62
|
} @packages; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# Now that we have a sorted list of packages, use that to build an array of |
128
|
|
|
|
|
|
|
# hashrefs for display. |
129
|
|
|
|
|
|
|
[ map { { $_ => $vermap->{$_} } } @packages ] |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
2
|
|
|
|
|
7
|
1; |
|
12
|
|
|
|
|
156
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=pod |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=encoding UTF-8 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 NAME |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Dist::Zilla::Util::AuthorDeps - Utils for listing your distribution's author dependencies |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 VERSION |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
version 6.028 |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 PERL VERSION |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This module should work on any version of perl still receiving updates from |
150
|
|
|
|
|
|
|
the Perl 5 Porters. This means it should work on any version of perl released |
151
|
|
|
|
|
|
|
in the last two to three years. (That is, if the most recently released |
152
|
|
|
|
|
|
|
version is v5.40, then this module should work on both v5.40 and v5.38.) |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Although it may work on older versions of perl, no guarantee is made that the |
155
|
|
|
|
|
|
|
minimum required version will not be increased. The version may be increased |
156
|
|
|
|
|
|
|
for any reason, and there is no promise that patches will be accepted to lower |
157
|
|
|
|
|
|
|
the minimum required perl. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 AUTHOR |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Ricardo SIGNES 😏 <cpan@semiotic.systems> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This software is copyright (c) 2022 by Ricardo SIGNES. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
168
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |