[carton] 258/472: Stop using lib::core::only and PERL5OPT for now, in favor of simpler PERL5LIB. Re: #82 #70 #60
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:52 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 de2b4d23bb92a818dfb89799f24913df9462c6da
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Sun Jun 2 12:23:50 2013 +0900
Stop using lib::core::only and PERL5OPT for now, in favor of simpler PERL5LIB. Re: #82 #70 #60
PERL5LIB isn't perfect since it doesn't eliminate site_perl from @INC
in the child process, which means carton exec could accidentally load
modules from site_perl even when they are not available in the
carton.lock.
We'll address this by either implementing a check-like logic in the
exec (which would add an overhead), or add some additional @INC hooks
in the development, which can detect such errors, a la App::FatPacker
---
lib/Carton/CLI.pm | 8 +++-----
xt/cli/exec.t | 14 +++++++-------
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 0b225d4..db88586 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -277,13 +277,11 @@ sub cmd_exec {
# allows -Ilib
@args = map { /^(-[I])(.+)/ ? ($1,$2) : $_ } @args;
- my @include;
- $self->parse_options_pass_through(\@args, 'I=s@', \@include);
+ $self->parse_options_pass_through(\@args, 'I=s@', sub { die "exec -Ilib is deprecated.\n" });
+ # PERL5LIB takes care of arch
my $path = $self->install_path;
- my $lib = join ",", @include, "$path/lib/perl5", ".";
-
- local $ENV{PERL5OPT} = "-Mlib::core::only -Mlib=$lib";
+ local $ENV{PERL5LIB} = "$path/lib/perl5";
local $ENV{PATH} = "$path/bin:$ENV{PATH}";
$UseSystem ? system(@args) : exec(@args);
diff --git a/xt/cli/exec.t b/xt/cli/exec.t
index 17d2bd5..bbb0e8a 100644
--- a/xt/cli/exec.t
+++ b/xt/cli/exec.t
@@ -13,8 +13,11 @@ use xt::CLI;
$app->dir->touch("cpanfile", '');
$app->run("install");
- $app->run("exec", "--", "perl", "-e", "use Try::Tiny");
- like $app->system_error, qr/Can't locate Try\/Tiny.pm/;
+ TODO: {
+ local $TODO = "exec now does not strip site_perl";
+ $app->run("exec", "perl", "-e", "use Try::Tiny");
+ like $app->system_error, qr/Can't locate Try\/Tiny.pm/;
+ }
$app->dir->touch("cpanfile", <<EOF);
requires 'Try::Tiny', '== 0.11';
@@ -28,11 +31,8 @@ EOF
$app->run("exec", "perl", "-e", 'use Try::Tiny; print $Try::Tiny::VERSION, "\n"');
like $app->system_output, qr/0\.11/, "No need for -- as well";
- TODO: {
- local $TODO = "Because of PERL5OPT loading order";
- $app->run("exec", "perl", "-MTry::Tiny", "-e", 'print $Try::Tiny::VERSION, "\n"');
- like $app->system_output, qr/0\.11/;
- }
+ $app->run("exec", "perl", "-MTry::Tiny", "-e", 'print $Try::Tiny::VERSION, "\n"');
+ like $app->system_output, qr/0\.11/;
$app->dir->touch("cpanfile", <<EOF);
requires 'Try::Tiny';
--
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