From: Vincent Pit Date: Sat, 15 Aug 2009 09:05:59 +0000 (+0200) Subject: Reduce namespace pollution X-Git-Tag: v0.08~18 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=ddbd1a23657ebbcc14b2fc408dbe3807d29bc122 Reduce namespace pollution Except for Cwd from which we still import abs_path(). File::Spec::Functions was replaced by File::Spec. --- diff --git a/Makefile.PL b/Makefile.PL index d0ddb50..f57eafa 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -30,13 +30,13 @@ WriteMakefile( ABSTRACT_FROM => 'lib/CPANPLUS/Dist/Gentoo.pm', PL_FILES => {}, PREREQ_PM => { - 'Carp' => 0, - 'CPANPLUS' => 0, - 'Cwd' => 0, - 'File::Copy' => 0, - 'File::Path' => 0, - 'File::Spec::Functions' => 0, - 'IPC::Cmd' => 0, + 'Carp' => 0, + 'CPANPLUS' => 0, + 'Cwd' => 0, + 'File::Copy' => 0, + 'File::Path' => 0, + 'File::Spec' => 0, + 'IPC::Cmd' => 0, }, MIN_PERL_VERSION => 5.006, META_MERGE => \%META, diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index b3032fd..5c4dd8e 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -4,9 +4,9 @@ use strict; use warnings; use Cwd qw/abs_path/; -use File::Copy qw/copy/; -use File::Path qw/mkpath/; -use File::Spec::Functions qw/catdir catfile/; +use File::Copy (); +use File::Path (); +use File::Spec; use IPC::Cmd qw/run can_run/; @@ -184,10 +184,10 @@ sub prepare { } $stat->fetched_arch($mod->status->fetch); - my $cur = File::Spec::Functions::curdir(); + my $cur = File::Spec->curdir(); my $portdir_overlay; for (@$overlays) { - if ($_ eq $overlay or File::Spec::Functions::abs2rel($overlay, $_) eq $cur) { + if ($_ eq $overlay or File::Spec->abs2rel($overlay, $_) eq $cur) { $portdir_overlay = [ @$overlays ]; last; } @@ -210,10 +210,16 @@ sub prepare { $stat->eb_name(CPANPLUS::Dist::Gentoo::Maps::name_c2g($name)); - $stat->eb_dir(catdir($stat->overlay, CATEGORY, $stat->eb_name)); + $stat->eb_dir(File::Spec->catdir( + $stat->overlay, + CATEGORY, + $stat->eb_name, + )); - my $file = catfile($stat->eb_dir, - $stat->eb_name . '-' . $stat->eb_version . '.ebuild'); + my $file = File::Spec->catfile( + $stat->eb_dir, + $stat->eb_name . '-' . $stat->eb_version . '.ebuild', + ); $stat->eb_file($file); if (-e $file) { @@ -303,7 +309,7 @@ sub create { my $dir = $stat->eb_dir; unless (-d $dir) { - eval { mkpath $dir }; + eval { File::Path::mkpath($dir) }; if ($@) { error "mkpath($dir): $@"; return 0; @@ -346,7 +352,7 @@ sub create { $stat->dist(undef); if ($stat->do_manifest) { - unless (copy $stat->fetched_arch, $stat->distdir) { + unless (File::Copy::copy($stat->fetched_arch => $stat->distdir)) { error "Couldn\'t copy the distribution file to distdir ($!) -- aborting"; 1 while unlink $file; return 0; @@ -377,8 +383,12 @@ sub _cpan2portage { my $atom = ($category eq 'virtual' ? 'perl-' : '') . $name; for my $portdir (@portdirs) { - my @ebuilds = glob catfile($portdir, $category, $atom,"$atom-*.ebuild"); - next unless @ebuilds; + my @ebuilds = glob File::Spec->catfile( + $portdir, + $category, + $atom, + "$atom-*.ebuild", + ) or next; if (defined $ver) { # implies that $version is defined for (@ebuilds) { @@ -457,7 +467,7 @@ Gentoo (L). L, L (core modules since 5.9.5). -L, L (since perl 5), L (5.001), L (5.002), L (5.00504). +L, L (since perl 5), L (5.001), L (5.002), L (5.00405). =head1 SEE ALSO