diff options
author | Justin Davis <jrcd83@gmail.com> | 2012-06-06 18:40:41 +0200 |
---|---|---|
committer | Justin Davis <jrcd83@gmail.com> | 2012-06-06 18:40:41 +0200 |
commit | 55ecbfeed55cd25b0b14fb98fbea7246ce1ac03f (patch) | |
tree | 2821b86151b472e66675cc1fe47d8cd795530d50 | |
parent | f96e1dc226501b4b1ff8b1e4086db01861804cc9 (diff) | |
download | genpkg-55ecbfeed55cd25b0b14fb98fbea7246ce1ac03f.tar.gz genpkg-55ecbfeed55cd25b0b14fb98fbea7246ce1ac03f.tar.xz |
Remove unnecessary code from perlcore.
-rwxr-xr-x | misc/perlcore | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/misc/perlcore b/misc/perlcore index 8787369..47c8543 100755 --- a/misc/perlcore +++ b/misc/perlcore @@ -3,10 +3,6 @@ use warnings 'FATAL' => 'all'; use strict; -package Common; - -# ---------------------------------------- - package CoreDist; use File::Basename qw(basename); @@ -14,35 +10,19 @@ use File::Find qw(); *findfile = *File::Find::find; *grokver = *main::grokver; -sub pathmod -{ - my($p) = @_; - for ($p){ - s{^lib/}{}; - s{[.]pm$}{}; - s{/}{::}g; - } - return $p; -} - sub findpmfiles { my($ddir) = @_; - $ddir = "$ddir/lib" if(-d "$ddir/lib"); - my @modpaths; + my @paths; my $finder = sub { return unless(/[.]pm$/); return if(m{/t/}); - - my $p = $_; - s{^\Q$ddir\E/}{}; - my $m = pathmod($_); - push @modpaths, [ $m, $p ]; + push @paths, $_; }; findfile({ 'no_chdir' => 1, 'wanted' => $finder }, $ddir); - return @modpaths; + return @paths; } sub solopm @@ -62,22 +42,17 @@ sub solopm sub findpms # a foolhardy task! { my($ddir) = @_; - return solopm($ddir) || findpmfiles($ddir); + return findpmfiles($ddir); } sub findpl { my($p) = @_; - - my $m; my $d = $p; $d =~ s{.+/}{}; - $m = $d; - $m =~ s{-}{::}g; - $d =~ s{.+-}{}; $p = "${p}/${d}_pm.PL"; - return (-f $p ? [ $m, $p ] : undef); + return (-f $p ? $p : ()); } # scans a directory full of nicely separated dist. directories. @@ -90,12 +65,11 @@ sub scan_distroot my @found = map { my $ddir = $_; - findpl($ddir) or findpms($ddir); + (findpl($ddir), findpms($ddir)); } map { "$distroot/$_" } @dists; return map { - my(undef, $p) = @$_; - my($m, $v) = grokver($p); + my($m, $v) = grokver($_); ($m ? [ $m, $v ] : ()); } @found; } |