[carton] 318/472: only warn (and eat) -Ilib when it's right after exec. Fix #97
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:59 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 bd30e7cb853dd4c526abefcf7fc2a65e28e03793
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Mon Jun 17 13:28:08 2013 -0700
only warn (and eat) -Ilib when it's right after exec. Fix #97
---
lib/Carton/CLI.pm | 11 ++++++++++-
xt/cli/exec.t | 17 +++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index c9d6574..bd129d5 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -355,7 +355,16 @@ sub cmd_exec {
# allows -Ilib
@args = map { /^(-[I])(.+)/ ? ($1,$2) : $_ } @args;
- $self->parse_options_pass_through(\@args, 'I=s@', sub { die "exec -Ilib is deprecated.\n" });
+ while (@args) {
+ if ($args[0] eq '-I') {
+ warn "exec -Ilib is deprecated. Just run the following command with -I.\n";
+ splice(@args, 0, 2);
+ } else {
+ last;
+ }
+ }
+
+ $self->parse_options_pass_through(\@args); # to handle --
unless (@args) {
$self->error("carton exec needs a command to run.\n");
diff --git a/xt/cli/exec.t b/xt/cli/exec.t
index f1487af..af0bfd4 100644
--- a/xt/cli/exec.t
+++ b/xt/cli/exec.t
@@ -55,5 +55,22 @@ EOF
like $app->stdout, qr/Mojolicious \(4\.01/;
};
+subtest 'carton exec perl -Ilib', sub {
+ my $app = cli();
+ $app->write_cpanfile('');
+ $app->run("install");
+
+ $app->dir->child("lib")->mkpath;
+ $app->dir->child("lib/FooBarBaz.pm")->spew("package FooBarBaz; 1");
+
+ $app->run("exec", "perl", "-Ilib", "-e", 'use FooBarBaz; print "foo"');
+ like $app->stdout, qr/foo/;
+ unlike $app->stderr, qr/exec -Ilib is deprecated/;
+
+ $app->run("exec", "-Ilib", "perl", "-e", 'print "foo"');
+ like $app->stdout, qr/foo/;
+ like $app->stderr, qr/exec -Ilib is deprecated/;
+};
+
done_testing;
--
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