From: Vincent Pit Date: Sat, 15 Aug 2009 08:49:47 +0000 (+0200) Subject: Better logic for capturing "emerge --info" output X-Git-Tag: v0.08~21 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=bad6ecaf3e526f13b487fac29c30c048d1252b42 Better logic for capturing "emerge --info" output --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index e6dcb36..177c70f 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -84,22 +84,22 @@ sub format_available { } if (IPC::Cmd->can_capture_buffer) { - my ($success, $errmsg, $output) = run command => [ qw/emerge --info/ ], - verbose => 0; + my $buffers; + my ($success, $errmsg) = run command => [ qw/emerge --info/ ], + verbose => 0, + buffer => \$buffers; if ($success) { - for (@{$output || []}) { - if (/^PORTDIR_OVERLAY=(.*)$/m) { - $overlays = [ map abs_path($_), split ' ', _unquote($1) ]; - } - if (/^ACCEPT_KEYWORDS=(.*)$/m) { - $default_keywords = [ split ' ', _unquote($1) ]; - } - if (/^DISTDIR=(.*)$/m) { - $default_distdir = abs_path(_unquote($1)); - } - if (/^PORTDIR=(.*)$/m) { - $main_portdir = abs_path(_unquote($1)); - } + if ($buffers =~ /^PORTDIR_OVERLAY=(.*)$/m) { + $overlays = [ map 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)); + } + if ($buffers =~ /^PORTDIR=(.*)$/m) { + $main_portdir = abs_path(_unquote($1)); } } else { error $errmsg;