[carton] 123/472: use Capture::Tiny to capture cpanm output

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 88ad590a73fc2aa2578bcfcd56fc081a053ed7a3
Author: Christian Walde <walde.christian at googlemail.com>
Date:   Tue Oct 18 12:13:04 2011 +0200

    use Capture::Tiny to capture cpanm output
---
 Makefile.PL   |  1 +
 lib/Carton.pm | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 51151bd..932e0e0 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,6 +14,7 @@ requires 'Try::Tiny', 0.09;
 requires 'parent', 0.223;
 requires 'local::lib', 1.008;
 requires 'Exception::Class', 1.32;
+requires 'Capture::Tiny';
 
 # MYMETA support
 requires 'App::cpanminus', 1.5000;
diff --git a/lib/Carton.pm b/lib/Carton.pm
index 14beb46..842bc3d 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -10,6 +10,7 @@ use Config qw(%Config);
 use Carton::Util;
 use CPAN::Meta;
 use File::Path;
+use Capture::Tiny 'capture';
 
 use constant CARTON_LOCK_VERSION => '0.9';
 our $DefaultMirror = 'http://cpan.metacpan.org/';
@@ -263,13 +264,13 @@ sub build_deps {
 sub run_cpanm_output {
     my($self, @args) = @_;
 
-    my $pid = open(my $kid, "-|"); # XXX portability
-    if ($pid) {
-        return <$kid>;
-    } else {
+    my $deps = capture {
         local $ENV{PERL_CPANM_OPT};
-        exec "cpanm", "--quiet", "-L", $self->{path}, @args;
-    }
+        system "cpanm", "--quiet", "-L", $self->{path}, @args;
+    };
+    my @deps = split $/, $deps;
+
+    return @deps;
 }
 
 sub run_cpanm {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git



More information about the Pkg-perl-cvs-commits mailing list