Perl日記

日々の知ったことのメモなどです。Perlは最近やってないです。

carton execでGetopt::Long

自分もメモ。
コマンド実行時に「--」で明確に引数の終わりを示さないと、carton上のGetopt::Longが動かなかった。

# hoge.pl
use Getopt::Long;

my $verbose = '';
GetOptions ('verbose' => \$verbose);

print "verbose: $verbose\n";
$ carton exec perl ./hoge.pl --verbose
verbose:
$ carton exec -- perl ./hoge.pl --verbose
verbose: 1


参考:
The CPAN Search Site - search.cpan.orgshell - What does "--" (double-dash) mean? - Unix & Linux Stack Exchange