From: Vincent Pit Date: Fri, 16 Apr 2010 23:51:52 +0000 (+0200) Subject: Reduce namespace pollution X-Git-Tag: v0.10~5 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=07d33f17ee02bcd968eb70a7cf1870eee2c954ac;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Reduce namespace pollution --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 55a51cf..a3264bb 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -3,13 +3,13 @@ package CPANPLUS::Dist::Gentoo; use strict; use warnings; -use Cwd qw/abs_path/; +use Cwd (); use List::Util qw/reduce/; use File::Copy (); use File::Path (); use File::Spec; -use IPC::Cmd qw/run can_run/; +use IPC::Cmd (); use Parse::CPAN::Meta (); use CPANPLUS::Error (); @@ -150,7 +150,7 @@ sub format_available { return $format_available if defined $format_available; for my $prog (qw/emerge ebuild/) { - unless (can_run($prog)) { + unless (IPC::Cmd::can_run($prog)) { __PACKAGE__->_abort("$prog is required to write ebuilds"); return $format_available = 0; } @@ -158,21 +158,23 @@ sub format_available { if (IPC::Cmd->can_capture_buffer) { my $buffers; - my ($success, $errmsg) = run command => [ qw/emerge --info/ ], - verbose => 0, - buffer => \$buffers; + my ($success, $errmsg) = IPC::Cmd::run( + command => [ qw/emerge --info/ ], + verbose => 0, + buffer => \$buffers, + ); if ($success) { if ($buffers =~ /^PORTDIR_OVERLAY=(.*)$/m) { - $overlays = [ map abs_path($_), split ' ', $unquote->($1) ]; + $overlays = [ map Cwd::abs_path($_), split ' ', $unquote->($1) ]; } if ($buffers =~ /^ACCEPT_KEYWORDS=(.*)$/m) { $default_keywords = [ split ' ', $unquote->($1) ]; } if ($buffers =~ /^DISTDIR=(.*)$/m) { - $default_distdir = abs_path($unquote->($1)); + $default_distdir = Cwd::abs_path($unquote->($1)); } if ($buffers =~ /^PORTDIR=(.*)$/m) { - $main_portdir = abs_path($unquote->($1)); + $main_portdir = Cwd::abs_path($unquote->($1)); } } else { __PACKAGE__->_abort($errmsg); @@ -252,11 +254,11 @@ sub prepare { $stat->footer($footer); my $overlay = delete $opts{overlay}; - $overlay = (defined $overlay) ? abs_path $overlay : '/usr/local/portage'; + $overlay = (defined $overlay) ? Cwd::abs_path($overlay) : '/usr/local/portage'; $stat->overlay($overlay); my $distdir = delete $opts{distdir}; - $distdir = (defined $distdir) ? abs_path $distdir : $default_distdir; + $distdir = (defined $distdir) ? Cwd::abs_path($distdir) : $default_distdir; $stat->distdir($distdir); return $FAIL->("distdir isn't writable") if $stat->do_manifest && !-w $distdir; @@ -621,7 +623,10 @@ sub _run { my ($success, $errmsg, $output) = do { local $ENV{PORTDIR_OVERLAY} = join ' ', @{$stat->portdir_overlay}; local $ENV{PORTAGE_RO_DISTDIRS} = $stat->distdir; - run command => $cmd, verbose => $verbose; + IPC::Cmd::run( + command => $cmd, + verbose => $verbose, + ); }; unless ($success) {