cpan2arch/GetMetadata.pm

filter: Statementstmt 13.0% 31 / 237 Branchbran 0.0% 0 / 82 Conditioncond 0.0% 0 / 41 MC/DCmcdc 0.0% 0 / 24 Subroutinesub 36.8% 7 / 19 Podpod 14.2% 1 / 7 totaltotal 9.5% 39 / 410 CC 62 SCAR 55.3
CC
62
Cov
9%
_find_files
506.0
_get_mua
342.0
get_metadata
156.0
CRAP 251.7
« cpan2arch/MergePrereqs.pm ↑ Summary cpan2arch.pm »
1 1 ▶use v5.42.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶no source::encoding; # Avoid dying on v5.42.0 (non-ASCII char in POD).
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Object::Pad 0.825;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 package App::cpan2arch::GetMetadata; # For toolchain compatibility.
10 role App::cpan2arch::GetMetadata;
11  
12 1 ▶use File::Spec::Functions qw< catdir splitdir >;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Scalar::Util qw< looks_like_number >;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 our $VERSION = 'v1.1.2';
16  
17 field %_endpoints :reader :writer = (
18 0 module => 'https://fastapi.metacpan.org/v1/module/',
19 release => 'https://fastapi.metacpan.org/v1/release/',
20 download => 'https://fastapi.metacpan.org/v1/download_url/',
21 );
22 0 ▶field $_mua_mcpan :reader;
Subroutine endpoints: not called CC=1 SCAR=3.1
Subroutine mua_mcpan: not called CC=1 SCAR=3.1
Subroutine set_endpoints: not called CC=1 SCAR=3.1
Pod undocumented
Pod undocumented
Pod undocumented
23 0 ▶field %_optionals :reader;
Subroutine optionals: not called CC=1 SCAR=2.6
Pod undocumented
24 0 ▶field %_meta :reader :writer;
Subroutine meta: not called CC=1 SCAR=4.1
Subroutine set_meta: not called CC=1 SCAR=4.1
Pod undocumented
Pod undocumented
25  
26 # Get CPAN metadata from MetaCPAN's API.
27 #
28 # References:
29 # https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md
30 0 ▶method get_metadata ()
Subroutine get_metadata: not called CC=12 SCAR=50.5
Pod documented
31 {
32 0 $self->_psub;
33  
34 0 $self->_init_mua_mcpan;
35  
36 # Get the module/distribution and its release.
37 0 my $dist;
38 my $rel;
39 {
40 0 my %args = $self->args;
41 0 my $module = $args{module};
42 0 my $version = $args{version};
43 0 my $mod;
44  
45 # Only request for a module if it does not look like a dist and no version
46 # argument is passed, otherwise treat it as dist.
47 0 ▶ if ( $module !~ /-/ && !defined $version ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($module =~ /-/u or defined $version) 0 0 0
Condition0%0/3
$module =~ /-/u or defined $version
l!l&&r!l&&!r
000
MC/DC0%0/2
$module =~ /-/u or defined $version
$module =~ /-/u defined $version
Truth table0%0/3
A or B
A= $module =~ /-/uB= defined $version
ABresult
1X1
011
000
48 0 $mod = $self->_get_module($module);
49 0 ▶ $self->_pdbg("found module\n\n") if defined $mod;
Branch: 1 branch
BranchTrueFalseTotal
if defined $mod 0 0 0
50 }
51  
52 # Since modules and dists names can be ambiguous, e.g. Reply, do not exit
53 # if a module request fails, but fallback as dist.
54 0 ▶ $dist = defined $mod ? $mod->{distribution} : $module;
Branch: 1 branch
BranchTrueFalseTotal
defined $mod ? : 0 0 0
55  
56 0 $self->_pdbg("Dist\n");
57 0 $self->_pdump( '$dist', \$dist, "\n" );
58  
59 0 $rel = $self->_get_release($dist);
60 0 ▶ return 1 if $rel == 1;
Branch: 1 branch
BranchTrueFalseTotal
if $rel == 1 0 0 0
61  
62 0 $self->_pdbg("Release\n");
63 0 $self->_pdump( '$rel', \$rel, "\n" );
64 }
65  
66 # Find Module::Install, license, and XS files in the dist.
67 0 my $ret = $self->_find_files( $dist, $rel->{download_url} );
68 0 ▶ return 1 if looks_like_number($ret) && $ret == 1;
Branch: 1 branch
BranchTrueFalseTotal
if &looks_like_number($ret) and $ret == 1 0 0 0
Condition0%0/3
&looks_like_number($ret) and $ret == 1
!ll&&!rl&&r
000
MC/DC0%0/2
&looks_like_number($ret) and $ret == 1
&looks_like_number($ret) $ret == 1
Truth table0%0/3
A and B
A= &looks_like_number($ret)B= $ret == 1
ABresult
0X0
100
111
69 0 my %files = $ret->%*;
70  
71 # Get 'optionals_features' descriptions (will be added to the optdepends array).
72 # See https://metacpan.org/pod/CPAN::Meta::Spec#optional_features.
73 {
74 0 foreach my ( $feature, $feat_info ) ( $rel->{metadata}{optional_features}->%* ) {
75  
76 0 foreach my ( $phase, $phase_info ) ( $feat_info->{prereqs}->%* ) {
77  
78 0 foreach my ( $relation, $rel_info ) ( $phase_info->%* ) {
79  
80 0 foreach my ( $module, $version ) ( $rel_info->%* ) {
81 0 push $_optionals{$module}->@*, $feat_info->{description};
82 }
83 }
84 }
85 }
86  
87 0 $self->_pdump( '%_optionals', \%_optionals, "\n" );
88 }
89  
90 %_meta = (
91 author => $rel->{author},
92 name => $rel->{name},
93 dist => $rel->{distribution},
94 version => $rel->{version},
95 abstract => $rel->{abstract},
96 license => $rel->{license},
97 spdx_expression => $rel->{metadata}{x_spdx_expression},
98 dependency => $rel->{dependency},
99 download_url => $rel->{download_url},
100 checksum => $rel->{checksum_sha256},
101 has_module_install => $files{mi},
102 has_license => $files{license},
103 has_multi_licenses => $files{has_multi_licenses},
104 has_xs => $files{xs},
105 0 );
106 0 $self->_pdump( '%_meta', \%_meta, "\n" );
107  
108 0 return 0;
109 1 }
110  
111 0 ▶method _init_mua_mcpan ()
Subroutine _init_mua_mcpan: not called CC=1 SCAR=6.9
112 {
113 0 $self->_psub;
114  
115 0 $_mua_mcpan = $self->_get_mua('mcpan');
116  
117 0 return $self;
118 1 }
119  
120 # Create a Mojo::UserAgent instance.
121 0 ▶method _get_mua ($type)
Subroutine _get_mua: not called CC=18 SCAR=58.3
122 {
123 0 ▶ return undef if $type ne 'mcpan' && $type ne 'arch';
Branch: 1 branch
BranchTrueFalseTotal
if $type ne "mcpan" and $type ne "arch" 0 0 0
Condition0%0/3
$type ne "mcpan" and $type ne "arch"
!ll&&!rl&&r
000
MC/DC0%0/2
$type ne "mcpan" and $type ne "arch"
$type ne "mcpan" $type ne "arch"
Truth table0%0/3
A and B
A= $type ne "mcpan"B= $type ne "arch"
ABresult
0X0
100
111
124  
125 # Caching support
126 0 my $has_muac = do {
127 0 try {
128 0 require Mojo::UserAgent::Cached;
129 0 Mojo::UserAgent::Cached->VERSION('1.25');
130 }
131 catch ($e) {
132 # Use Mojo::UA as fallback.
133 0 require Mojo::UserAgent;
134  
135 0 $self->_pdbg("Mojo::UserAgent::Cached is not installed\n\n");
136 0 undef;
137 }
138 };
139 0 my $has_chi = do {
140 0 ▶ if ( defined $has_muac ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $has_muac) 0 0 0
141 0 try {
142 0 require CHI;
143 0 CHI->VERSION('0.61');
144 }
145 catch ($e) {
146 0 $self->_pdbg("CHI is not installed\n\n");
147 0 undef;
148 }
149 }
150 };
151  
152 0 my %env = $self->env;
153 0 my %opts = $self->opts;
154 0 my $mua;
155  
156 0 ▶ if ( defined $has_muac && defined $has_chi ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $has_muac and defined $has_chi) { } 0 0 0
Condition0%0/3
defined $has_muac and defined $has_chi
!ll&&!rl&&r
000
MC/DC0%0/2
defined $has_muac and defined $has_chi
defined $has_muac defined $has_chi
Truth table0%0/3
A and B
A= defined $has_muacB= defined $has_chi
ABresult
0X0
100
111
157 0 require Mojo::Log;
158  
159 # Silence logger
160 0 my $logger;
161 0 ▶ $logger = Mojo::Log->new( path => '/dev/null' ) unless $env{debug};
Branch: 1 branch
BranchTrueFalseTotal
unless $env{"debug"} 0 0 0
162  
163 $mua = Mojo::UserAgent::Cached->new(
164 $env{debug}
165 ? ()
166 0 ▶ : ( logger => $logger ),
Branch: 1 branch
BranchTrueFalseTotal
$env{'debug'} ? : 0 0 0
167 );
168  
169 # Use CHI as the cache backend.
170 {
171 0 my $path =
172 $type eq 'mcpan'
173 ? $env{cache_mcpan_path}
174 0 ▶ : $env{cache_arch_path};
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'mcpan' ? : 0 0 0
175  
176 0 my $chi;
177  
178 $chi = CHI->new(
179 driver => 'File',
180 root_dir => $path,
181 expires_in => $env{cache_expiration},
182 0 ▶ ) unless $env{cache_ignore};
Branch: 1 branch
BranchTrueFalseTotal
unless $env{"cache_ignore"} 0 0 0
183  
184 0 ▶ if ( defined $chi ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $chi) 0 0 0
185 $chi->clear
186 if defined $opts{clear}
187 || ( $type eq 'mcpan' && defined $opts{clear_mcpan} )
188 0 ▶ || ( $type eq 'arch' && defined $opts{clear_arch} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $opts{"clear"} or $type eq "mcpan" and defined $opts{"clear_mcpan"} or $type eq "arch" and defined $opts{"clear_arch"} 0 0 0
Condition0%0/12
defined $opts{"clear"} or $type eq "mcpan" and defined $opts{"clear_mcpan"} or $type eq "arch" and defined $opts{"clear_arch"}
l!l&&r!l&&!r
000
defined $opts{"clear"} or $type eq "mcpan" and defined $opts{"clear_mcpan"}
l!l&&r!l&&!r
000
$type eq "mcpan" and defined $opts{"clear_mcpan"}
!ll&&!rl&&r
000
$type eq "arch" and defined $opts{"clear_arch"}
!ll&&!rl&&r
000
MC/DC0%0/5
defined $opts{"clear"} or $type eq "mcpan" and defined $opts{"clear_mcpan"} or $type eq "arch" and defined $opts{"clear_arch"}
defined $opts{"clear"} $type eq "mcpan" defined $opts{"clear_mcpan"} $type eq "arch" defined $opts{"clear_arch"}
Truth table0%0/8
A or B and C or D and E
A= defined $opts{"clear"}B= $type eq "mcpan"C= defined $opts{"clear_mcpan"}D= $type eq "arch"E= defined $opts{"clear_arch"}
ABCDEresult
1XXXX1
011XX1
00X111
010111
00X0X0
00X100
0100X0
010100
189 }
190  
191 0 ▶ $mua->cache_agent($chi) unless $env{cache_ignore};
Branch: 1 branch
BranchTrueFalseTotal
unless $env{"cache_ignore"} 0 0 0
192 }
193 }
194 else {
195 0 $mua = Mojo::UserAgent->new;
196 }
197  
198 0 ▶ $mua->transactor->name( $env{user_agent} ) if defined $mua;
Branch: 1 branch
BranchTrueFalseTotal
if defined $mua 0 0 0
199  
200 0 return $mua;
201 1 }
202  
203 0 ▶method _get_module ($module)
Subroutine _get_module: not called CC=5 SCAR=34.0
204 {
205 0 $self->_psub;
206  
207 0 my $prog = $self->prog;
208 0 my $url = $_endpoints{module} . "$module?fields=distribution";
209 0 my $json;
210  
211 0 my $res = do {
212 0 try {
213 0 my %env = $self->env;
214 0 ▶ local $ENV{MUAC_NOCACHE} = true if $env{cache_ignore};
Branch: 1 branch
BranchTrueFalseTotal
if $env{"cache_ignore"} 0 0 0
215  
216 0 $_mua_mcpan->get($url)->result;
217 }
218 catch ($e) {
219 0 warn $e;
220 0 undef;
221 }
222 };
223  
224 0 ▶ if ( defined $res && $res->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $res and $res->is_success) 0 0 0
Condition0%0/3
defined $res and $res->is_success
!ll&&!rl&&r
000
MC/DC0%0/2
defined $res and $res->is_success
defined $res $res->is_success
Truth table0%0/3
A and B
A= defined $resB= $res->is_success
ABresult
0X0
100
111
225 0 $self->_pdbg("\n");
226 0 $json = $res->json;
227 }
228  
229 0 ▶ if ( !defined $json ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $json) 0 0 0
230 0 warn "$prog: failed to fetch $module module\n";
231 0 $self->_pdbg("\n");
232  
233 0 return undef;
234 }
235  
236 0 return $json;
237 1 }
238  
239 # References:
240 # https://blogs.perl.org/users/neilb/2016/12/working-with-the-metacpan-api.html.
241 0 ▶method _get_release ($dist)
Subroutine _get_release: not called CC=9 SCAR=45.0
242 {
243 0 $self->_psub;
244  
245 0 my %args = $self->args;
246 0 my $version = $args{version};
247 0 my $prog = $self->prog;
248  
249 0 my $query = "distribution:$dist%20AND%20";
250 0 ▶ $query
Branch: 1 branch
BranchTrueFalseTotal
defined $version ? : 0 0 0
251 .= defined $version
252 ? "version:$version"
253 : 'status:latest';
254  
255 0 my $url = $_endpoints{release} . "_search?q=$query";
256  
257 0 my $res = do {
258 0 try {
259 0 my %env = $self->env;
260 0 ▶ local $ENV{MUAC_NOCACHE} = true if $env{cache_ignore};
Branch: 1 branch
BranchTrueFalseTotal
if $env{"cache_ignore"} 0 0 0
261  
262 0 $_mua_mcpan->get($url)->result;
263 }
264 catch ($e) {
265 0 warn $e;
266 0 undef;
267 }
268 };
269  
270 0 my $json;
271 my $rel;
272  
273 0 ▶ if ( defined $res && $res->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $res and $res->is_success) 0 0 0
Condition0%0/3
defined $res and $res->is_success
!ll&&!rl&&r
000
MC/DC0%0/2
defined $res and $res->is_success
defined $res $res->is_success
Truth table0%0/3
A and B
A= defined $resB= $res->is_success
ABresult
0X0
100
111
274 0 $self->_pdbg("\n");
275  
276 0 $json = $res->json;
277 $rel = $json->{hits}{hits}[0]{_source}
278 0 ▶ if defined $json && scalar $json->{hits}{hits}->@*;
Branch: 1 branch
BranchTrueFalseTotal
if defined $json and scalar @{$json->{"hits"}{"hits"}} 0 0 0
Condition0%0/2
defined $json and scalar @{$json->{"hits"}{"hits"}}
!ll
00
MC/DC0%0/1
defined $json and scalar @{$json->{"hits"}{"hits"}}
defined $json
Truth table0%0/2
A
A= defined $json
Aresult
00
11
279 }
280  
281 0 ▶ if ( !defined $json || !defined $rel ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $json and defined $rel) 0 0 0
Condition0%0/3
defined $json and defined $rel
!ll&&!rl&&r
000
MC/DC0%0/2
defined $json and defined $rel
defined $json defined $rel
Truth table0%0/3
A and B
A= defined $jsonB= defined $rel
ABresult
0X0
100
111
282 0 warn "$prog: failed to fetch $dist dist release\n";
283 0 return 1;
284 }
285  
286 0 return $rel;
287 1 }
288  
289 # Check if the distribution has some type of files (M::I, license, XS).
290 0 ▶method _find_files ( $dist, $download_url )
Subroutine _find_files: not called CC=22 SCAR=62.3
291 {
292 0 $self->_psub;
293  
294 0 require Path::Tiny;
295 0 Path::Tiny->VERSION('0.150');
296  
297 0 require Archive::Tar;
298  
299 0 my $prog = $self->prog;
300 0 my %files = (
301 mi => false,
302 license => false,
303 has_multi_licenses => false,
304 xs => false,
305 );
306  
307 0 my $res = do {
308 0 try {
309 0 my %env = $self->env;
310 0 ▶ local $ENV{MUAC_NOCACHE} = true if $env{cache_ignore};
Branch: 1 branch
BranchTrueFalseTotal
if $env{"cache_ignore"} 0 0 0
311  
312 0 $_mua_mcpan->get($download_url)->result;
313 }
314 catch ($e) {
315 0 warn $e;
316 0 undef;
317 }
318 };
319  
320 0 ▶ if ( !defined $res ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $res) 0 0 0
321 0 warn "$prog: failed to fetch $dist tarball release: $download_url\n";
322 0 return 1;
323 }
324  
325 0 ▶ if ( $res->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->is_success) 0 0 0
326 0 $self->_pdbg("\n");
327  
328 # Read tarball
329 0 my @tar_files;
330 {
331 # Save tarball to tempdir so Archive::Tar can detect its compress type.
332 0 my ($fname) = $download_url =~ m{/([^/]+)\z};
333 0 my $temp = Path::Tiny->tempdir;
334 0 my $tarball = $temp->child($fname);
335  
336 0 $res->save_to($tarball);
337  
338 0 my $tar = Archive::Tar->new($tarball);
339  
340 0 ▶ if ( !defined $tar ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $tar) 0 0 0
341 0 warn "$prog: failed to read $fname\n";
342 0 return 1;
343 }
344  
345 0 @tar_files = $tar->get_files;
346 #$self->_pdump( '@tar_files', \@tar_files, "\n" );
347 }
348  
349 0 my @licenses;
350  
351 0 foreach my $f (@tar_files) {
352 0 ▶ if ( $f->is_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->is_file) 0 0 0
353 0 ▶ my $path =
Branch: 1 branch
BranchTrueFalseTotal
$f->prefix ne '' ? : 0 0 0
354 $f->prefix ne ''
355 ? catdir( $f->prefix, $f->name )
356 : $f->name;
357  
358 0 my @dirs = splitdir($path);
359  
360 # Only top level license files.
361 0 ▶ if ( scalar @dirs == 2 ) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @dirs == 2) { } 0 0 0
elsif (scalar @dirs == 4) { } 0 0 0
362 0 my $license = $dirs[1];
363  
364 0 ▶ if ( $license =~ /\A(?> LICEN[CS]E | COPYRIGHT | COPYING)(?> [-_.][^\n]+ )?\z/x ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($license =~ /\A(?> LICEN[CS]E | COPYRIGHT | COPYING)(?> [-_.][^\n]+ )?\z/ux) 0 0 0
365 0 push @licenses, $license;
366 0 $self->_pdbg("found license: $license\n");
367 }
368 }
369 elsif ( scalar @dirs == 4 ) {
370 0 my $mi = catdir( $dirs[0], qw< inc Module Install.pm > );
371  
372 # ../inc/Module/Install.pm
373 0 ▶ if ( $f->name eq $mi ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->name eq $mi) 0 0 0
374 0 $files{mi} = true;
375 0 $self->_pdbg("found Install.pm\n");
376 }
377 }
378 }
379 }
380  
381 0 $self->_pdbg("\n");
382  
383 0 ▶ if ( scalar @licenses ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @licenses) 0 0 0
384 # Multiple licenses is uncommon in Perl, so just return a single license
385 # for simplicity, but flag multiple files.
386 0 @licenses = sort @licenses;
387 0 $files{license} = $licenses[0];
388 0 ▶ $files{has_multi_licenses} = true
Branch: 1 branch
BranchTrueFalseTotal
if scalar @licenses > 1 0 0 0
389 if scalar @licenses > 1;
390  
391 0 $self->_pdump( '@licenses', \@licenses, "\n" );
392 }
393  
394 # XS
395 0 foreach my $f (@tar_files) {
396 0 ▶ if ( $f->is_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f->is_file) 0 0 0
397 0 ▶ my $path =
Branch: 1 branch
BranchTrueFalseTotal
$f->prefix ne '' ? : 0 0 0
398 $f->prefix ne ''
399 ? catdir( $f->prefix, $f->name )
400 : $f->name;
401  
402 0 my @dirs = splitdir($path);
403  
404 0 ▶ if ( scalar @dirs ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @dirs) 0 0 0
405 # Ignore irrelevant dirs.
406 0 ▶ next if $dirs[1] && $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/x;
Branch: 1 branch
BranchTrueFalseTotal
if $dirs[1] and $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/ux 0 0 0
Condition0%0/3
$dirs[1] and $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/ux
!ll&&!rl&&r
000
MC/DC0%0/2
$dirs[1] and $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/ux
$dirs[1] $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/ux
Truth table0%0/3
A and B
A= $dirs[1]B= $dirs[1] =~ /\A(?> inc | bin | script | eg | examples | share | x?t )\z/ux
ABresult
0X0
100
111
407  
408 0 my $fname = $dirs[-1];
409  
410 0 ▶ if ( $fname eq 'typemap' || $fname =~ /\A[^.]+\.xs\z/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fname eq "typemap" or $fname =~ /\A[^.]+\.xs\z/u) 0 0 0
Condition0%0/3
$fname eq "typemap" or $fname =~ /\A[^.]+\.xs\z/u
l!l&&r!l&&!r
000
MC/DC0%0/2
$fname eq "typemap" or $fname =~ /\A[^.]+\.xs\z/u
$fname eq "typemap" $fname =~ /\A[^.]+\.xs\z/u
Truth table0%0/3
A or B
A= $fname eq "typemap"B= $fname =~ /\A[^.]+\.xs\z/u
ABresult
1X1
011
000
411 0 $files{xs} = true;
412  
413 0 $self->_pdbg("found XS: $fname\n\n");
414 0 last;
415 }
416 }
417 }
418 }
419 }
420  
421 0 $self->_pdump( '%files', \%files, "\n" );
422  
423 0 return \%files;
424 }
425  
426 =encoding UTF-8
427  
428 =for highlighter language=perl
429  
430 =head1 NAME
431  
432 App::cpan2arch::GetMetadata - get CPAN metadata from MetaCPAN's API
433  
434 =head1 SYNOPSIS
435  
436 use App::cpan2arch;
437  
438 my $cpan2arch = App::cpan2arch->new;
439  
440 ...
441  
442 =head1 DESCRIPTION
443  
444 This role handles the fetching of module/distribution metadata from
445 L<MetaCPAN's|https://github.com/metacpan/metacpan-api> API.
446  
447 =head1 METHODS
448  
449 =head2 get_metadata
450  
451 $cpan2arch->get_metadata;
452  
453 Takes no arguments and returns C<0> on success.
454  
455 =head1 BUGS
456  
457 Report bugs at L<https://github.com/ryoskzypu/App-cpan2arch/issues>.
458  
459 =head1 AUTHOR
460  
461 ryoskzypu <ryoskzypu@proton.me>
462  
463 =head1 SEE ALSO
464  
465 =over 4
466  
467 =item *
468  
469 L<https://blogs.perl.org/users/neilb/2016/12/working-with-the-metacpan-api.html>
470  
471 =back
472  
473 =head1 COPYRIGHT
474  
475 Copyright © 2026 ryoskzypu
476  
477 MIT-0 License. See LICENSE for details.
478  
479 =cut
« cpan2arch/MergePrereqs.pm ↑ Summary cpan2arch.pm »