[carton] 76/472: Allow -Ilib to exec

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:34 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 908bee3d4c521ccbfbd8cc21d6a843e084e73677
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Tue Jun 28 13:51:23 2011 -0400

    Allow -Ilib to exec
    
    Because of how PERL5OPT and -I/-M works, we can't reliably make
    `carton exec -- perl -Ilib foo.pl` nor even `-Mlib=lib` load library
    from lib. We allow `-Ilib` to be passed to the exec's option, so that:
    
        carton exec -Ilib -- perl script.pl
    
     would load modules from lib/, and makes the development easier.
    
    See lib::core::only/CAVEATS for details.
---
 lib/Carton/CLI.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 3c0eafa..c697416 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -360,11 +360,17 @@ sub cmd_update {
 sub cmd_exec {
     my($self, @args) = @_;
 
+    # allows -Ilib
+    @args = map { /^(-[I])(.+)/ ? ($1,$2) : $_ } @args;
+
     my $system; # for unit testing
-    $self->parse_options(\@args, "system", \$system); # always run parse_options to allow --
+    my @include;
+    $self->parse_options(\@args, 'I=s@', \@include, "system", \$system);
+
+    my $include = join ",", @include, ".";
 
     my $path = $self->config->get('path');
-    local $ENV{PERL5OPT} = "-MCarton::lib=. -Mlib=$path/lib/perl5";
+    local $ENV{PERL5OPT} = "-MCarton::lib=$include -Mlib=$path/lib/perl5";
     local $ENV{PATH} = "$path/bin:$ENV{PATH}";
 
     $system ? system(@args) : exec(@args);

-- 
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