From: Vincent Pit Date: Sat, 20 Dec 2008 18:40:59 +0000 (+0100) Subject: Better handling of the run of emerge --info X-Git-Tag: v0.05~12 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=commitdiff_plain;h=02fbb17472e55a0862fea51d8f4e530a9af9153c Better handling of the run of emerge --info --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index e0e6bb8..7f13804 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -66,17 +66,19 @@ sub format_available { } if (IPC::Cmd->can_capture_buffer) { - my $output = ''; - my $success = run command => [ qw/emerge --info/ ], - verbose => 0, - buffer => \$output; - if ($success and $output) { - if ($output =~ /^PORTDIR_OVERLAY=(.*)$/m) { - my $o = $1; - $o =~ s/^["']*//; - $o =~ s/["']*$//; - $overlays = [ map abs_path($_), grep length, split /:/, $o ]; + my ($success, $errmsg, $output) = run command => [ qw/emerge --info/ ], + verbose => 0; + if ($success) { + for (@{$output || []}) { + if (/^PORTDIR_OVERLAY=(.*)$/m) { + my $o = $1; + $o =~ s/^["']*//; + $o =~ s/["']*$//; + $overlays = [ map abs_path($_), grep length, split /:/, $o ]; + } } + } else { + error $errmsg; } }