Skip to content

Commit 2a14e35

Browse files
committed
Ingest: read_02packages_fh - supprort alternative file (for testing)
1 parent e18540e commit 2a14e35

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/MetaCPAN/Ingest.pm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,18 @@ sub read_00whois ( $file = undef ) {
330330
}
331331

332332
# TODO: replace usage with read_02packages
333-
sub read_02packages_fh ( $log_meta = 0 ) {
334-
my $cpan = cpan_dir();
335-
my $fh = $cpan->child(qw< modules 02packages.details.txt.gz >)
336-
->openr(':gzip');
333+
sub read_02packages_fh ( %args ) {
334+
my $log_meta = $args{log_meta} // 0;
335+
my $file = $args{file};
336+
337+
my $fh;
338+
if ( $file ) {
339+
$fh = path($file)->openr(':gzip');
340+
} else {
341+
my $cpan = cpan_dir();
342+
$fh = $cpan->child(qw< modules 02packages.details.txt.gz >)
343+
->openr(':gzip');
344+
}
337345

338346
# read first 9 lines (meta info)
339347
my $meta = "Meta info:\n";

0 commit comments

Comments
 (0)