Getopt-EX
view release on metacpan or search on metacpan
lib/Getopt/EX/Module.pm view on Meta::CPAN
if (defined &$func) {
no strict 'refs';
$func->(@param);
}
}
sub run_inits {
my $obj = shift;
my $argv = shift;
my $module = $obj->module;
local @ARGV = ();
call_if_defined $module, "initialize" => ($obj, $argv);
for my $call ($obj->call) {
my $func = $call->can('call') ? $call : parse_func($call);
$func->call;
}
call_if_defined $module, "finalize" => ($obj, $argv);
}
t/04_long.t view on Meta::CPAN
##
{
my $rc_content = "option default --default_inrc\n";
my $rc_path = "t/home/.examplerc";
my $fh = IO::File->new(">$rc_path") or die "$rc_path: $!\n";
print $fh $rc_content;
$fh->close;
$0 = "/usr/bin/example";
use Getopt::EX::Long;
local @ARGV = qw(-Mexample_test --drink-me arg1);
my $default;
my $default_inrc;
GetOptions(
"default" => \$default,
"default_inrc" => \$default_inrc,
);
ok($default, "--default");
ok($default_inrc, "--default_inrc");
is($ARGV[0], "poison", "args");
t/08_hashed.t view on Meta::CPAN
$ENV{HOME} = $home;
unshift @INC, $app_lib;
##
## GetOptions
##
{
$0 = "/usr/bin/example";
use Getopt::EX::Long;
local @ARGV = qw(-Mexample_test
--string Alice
--number 42
--list foo --list bar
--hash animal=dolphin --hash fish=babel
--default
--set-number 42
--set-list dont --set-list panic
--set-hash dont=panic
);
my %hash;
t/09_hashed_parser.t view on Meta::CPAN
$ENV{HOME} = $home;
unshift @INC, $app_lib;
##
## GetOptions
##
{
$0 = "/usr/bin/example";
use Getopt::EX::Long;
local @ARGV = qw(-Mexample_test
--string Alice
--number 42
--list foo --list bar
--hash animal=dolphin --hash fish=babel
--default
--set-number 42
--set-list dont --set-list panic
--set-hash dont=panic
--set-str dontpanic
);
( run in 0.714 second using v1.01-cache-2.11-cpan-49f99fa48dc )