diff options
Diffstat (limited to 'preps')
-rwxr-xr-x | preps/perl | 4 | ||||
-rwxr-xr-x | preps/perl.d/fetchcpan | 8 | ||||
-rwxr-xr-x | preps/perl.d/perl-dist | 19 |
3 files changed, 16 insertions, 15 deletions
@@ -24,7 +24,7 @@ sub matchdist my $var = $ENV{'PKGVAR'} or err('PKGVAR env variable is unset'); - if(!-f "$var/cpandists" || -M "$var/cpandists" > 1) { + if(!-f "$var/cpan.dists" || -M "$var/cpan.dists" > 1) { print STDERR "$PROG: Refreshing local CPAN data... "; my $cwd = getcwd(); chdir $var or die "chdir: $!"; @@ -34,7 +34,7 @@ sub matchdist chdir $cwd or die "chdir: $!"; } - open(DISTS, '<', "$var/cpandists") or err("open: $!"); + open(DISTS, '<', "$var/cpan.dists") or err("open: $!"); while(<DISTS>) { my @f = split; my $d = lc $f[0]; $d =~ tr/-_/--/s; diff --git a/preps/perl.d/fetchcpan b/preps/perl.d/fetchcpan index c39a3df..b9ddeaa 100755 --- a/preps/perl.d/fetchcpan +++ b/preps/perl.d/fetchcpan @@ -31,13 +31,13 @@ NR < 10 { next } END { for (dist in dists) { ver = dists[dist] - print dist, ver, paths[dist] | "sort >cpan.dists" + print dist, ver, paths[dist] | "sort > cpan.dists" } - close("sort >cpandists") + close("sort > cpan.dists") # Prints modules out in sorted order, too! - while(getline<"cpandists" > 0) { - print $1 "\n" mods[$1,$2] >"cpan.mods" + while((getline < "cpan.dists") > 0) { + print $1 "\n" mods[$1,$2] > "cpan.mods" } } diff --git a/preps/perl.d/perl-dist b/preps/perl.d/perl-dist index 4dd0d84..dd1413c 100755 --- a/preps/perl.d/perl-dist +++ b/preps/perl.d/perl-dist @@ -18,6 +18,7 @@ my %CoreMods = loadcore(); package Convert; *DBG = *main::DBG; +*vardir = *main::vardir; use LWP::UserAgent qw(); use YAML::XS qw(); @@ -298,9 +299,9 @@ sub _distsofmods return () if(@mods == 0); @mods = _nocore(@mods); - my $var = _vardir(); + my $var = vardir(); open my $fh, '<', "$var/cpan.mods" - or die "$PROG: failed to open $var/cpanmods: $!"; + or die "$PROG: failed to open $var/cpan.mods: $!"; my %mods = map { ($_ => 1) } @mods; my %dists; @@ -337,12 +338,6 @@ sub _nocore return @mods; } -sub _vardir -{ - return $ENV{'PKGVAR'} - or die "$PROG: PKGVAR env variable is unset\n"; -} - #----------------------------------------------------------------------------- package main; @@ -595,9 +590,15 @@ sub _readmedesc return undef; } +sub vardir +{ + return $ENV{'PKGVAR'} + or die "$PROG: PKGVAR env variable is unset\n"; +} + sub loadcore { - my $cmpath = _vardir() . '/perlcore.mods'; + my $cmpath = vardir() . '/perlcore.mods'; unless(-f $cmpath){ print STDERR <<"END_ERR"; $PROG: error: $cmpath is missing. |