Skip to content

Commit b0d11d1

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

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

bin/package.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# read the rest of the file line-by-line (too big to slurp)
2929

30-
my $fh_packages = read_02packages_fh(1);
30+
my $fh_packages = read_02packages_fh( log_meta => 1 );
3131
while ( my $line = <$fh_packages> ) {
3232
next unless $line;
3333
chomp($line);

lib/MetaCPAN/Ingest.pm

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,16 @@ sub read_02packages_fh ( %args ) {
355355
return $fh;
356356
}
357357

358-
sub read_02packages () {
359-
my $cpan = cpan_dir();
360-
return Parse::CPAN::Packages::Fast->new(
361-
$cpan->child(qw< modules 02packages.details.txt.gz >)->stringify );
358+
sub read_02packages ( $file = undef ) {
359+
my $content;
360+
if ( $file ) {
361+
$content = path($file)->stringify;
362+
} else {
363+
my $cpan = cpan_dir();
364+
$content = $cpan->child(qw< modules 02packages.details.txt.gz >)->stringify;
365+
}
366+
367+
return Parse::CPAN::Packages::Fast->new($content);
362368
}
363369

364370
# TODO: replace usage with unified read_06perms

0 commit comments

Comments
 (0)