Next refresh should show more results. ( run in 0.978 )
view release on metacpan or search on metacpan
$rv;
}
sub usage
{
my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
my %M = ( 'I' => '*' );
$usage =~ s/^\s*perl\s+\S+/$^X $0/;
$usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
print <<ENDUSAGE;
view all matches for this distribution
view release on metacpan or search on metacpan
$rv;
}
sub usage
{
my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
my %M = ( 'I' => '*' );
$usage =~ s/^\s*perl\s+\S+/$^X $0/;
$usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
print <<ENDUSAGE;
view all matches for this distribution
view release on metacpan or search on metacpan
src/ppport.h view on Meta::CPAN
print " --- hint for $func ---\n", $hint;
}
sub usage
{
my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
my %M = ( 'I' => '*' );
$usage =~ s/^\s*perl\s+\S+/$^X $0/;
$usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
print <<ENDUSAGE;
view all matches for this distribution
view release on metacpan or search on metacpan
# test that ssl_verify_mode 0x02 is indeed enforced. disabled for now.
# my $res = get('/test', 0);
my $got_cert = get('/test', 1);
my $expected_cert = do { local(@ARGV, $/) = $cert_file; <> };
is(parsed($got_cert), parsed($expected_cert));
} else {
my $daemon;
my $app = sub {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Getopt/Alt.pm view on Meta::CPAN
default =>
{ %{ $self->opt }, %{ $options->{default} || {} } },
},
$opt_args
);
local @ARGV = ();
if ( $self->opt->auto_complete ) {
push @args, '--auto-complete', $self->opt->auto_complete,
'--';
}
$sub_obj->process(@args);
view all matches for this distribution
view release on metacpan or search on metacpan
t/v005-10-usage.t view on Meta::CPAN
},
},
},
);
local @ARGV = qw/--apple mango/;
undef @path;
$options = Getopt::Chain->process(%process);
cmp_deeply($options, { qw/apple 1/ });
cmp_deeply(\@path, [ undef, qw/mango/ ]);
local @ARGV = qw/grape --banana ripe/;
undef @path;
$options = Getopt::Chain->process(%process);
cmp_deeply($options, { qw/banana ripe/ });
cmp_deeply(\@path, [ undef, qw/grape/ ]);
local @ARGV = qw/--apple grape --banana ripe/;
undef @path;
$options = Getopt::Chain->process(%process);
cmp_deeply($options, { qw/apple 1 banana ripe/ });
cmp_deeply(\@path, [ undef, qw/grape/ ]);
view all matches for this distribution
view release on metacpan or search on metacpan
t/001_basic.t view on Meta::CPAN
# my $options = $opt->options;
# $opt->message( $opt->dumper( $params ) ); exit;
isa_ok( $opt, 'Getopt::Class' );
{
local @ARGV = qw( --debug 3 --dry-run --name Bob --created 2020-04-12T07:30:10 --langs en ja --with-zlib --disable-compress --enable-logging );
my $opts = $opt->exec || diag( "Error: " . $opt->error );
ok( defined( $opts ), 'No Getopt::Long error' );
is( Scalar::Util::reftype( $opts ), 'HASH', 'Expecting a hash reference' );
is( $opts->{dry_run}, 1, 'Boolean option enabled' );
is( $opts->{debug}, 3, 'Scalar reference of integer set' );
view all matches for this distribution
view release on metacpan or search on metacpan
t/private/parse_argv.t view on Meta::CPAN
my ($input, $expects, $sub_command, $desc) =
@specs{qw/input expects sub_command desc/};
subtest $desc => sub {
local @ARGV = @$input;
$go->{_struct} = $sub_command || {};
my @opts = $go->_parse_argv;
is_deeply \@opts, $expects, 'parse argv';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Getopt/Complete/Args.pm view on Meta::CPAN
my $self = shift;
# as long as the first word is a valid sub-command, drill down to the subordinate options list,
# and also shift the args into a special buffer
# (if you have sub-commands AND bare arguments, and the arg is a valid sub-command ...don't do that
local @ARGV = @{ $self->{argv} };
my @sub_command_path;
while (@ARGV and my $delegate = $self->options->completion_handler('>' . $ARGV[0])) {
push @sub_command_path, shift @ARGV;
$self->{options} = $delegate;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/App/Foo.pm view on Meta::CPAN
no Getopt::EX::Hashed;
sub run {
my $app = shift;
local @ARGV = @_;
use Getopt::Long;
$app->getopt or die;
return @ARGV;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Getopt/Helpful.pm view on Meta::CPAN
} # end subroutine Get definition
########################################################################
=head2 Get_from
Equivalent to Get(@extra), but treats @args as a localized @ARGV.
$hopt->Get_from(\@args, @extra);
=cut
sub Get_from {
my $self = shift;
my ($args, @extra) = @_;
local @ARGV = @$args;
$self->Get(@extra);
@$args = @ARGV;
} # end subroutine Get_from definition
########################################################################
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_string.t view on Meta::CPAN
use Test::More 0.98;
use Getopt::Kingpin;
subtest 'string normal' => sub {
local @ARGV;
push @ARGV, qw(--name kingpin);
my $kingpin = Getopt::Kingpin->new;
$kingpin->flag('name', 'set name')->string();
$kingpin->parse;
is $kingpin->flags->get('name'), 'kingpin';
};
subtest 'string normal 2 options' => sub {
local @ARGV;
push @ARGV, qw(--name kingpin --xyz abcde);
my $k = Getopt::Kingpin->new;
$k->flag('name', 'option 1')->string;
$k->flag('xyz', 'option 2')->string;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
use Getopt::Long::Complete;
is($REQUIRE_ORDER, 0);
subtest GetOptions => sub {
local @ARGV = ("--foo", "--bar", "baz");
my %opts;
GetOptions(
'foo' => \$opts{foo},
'bar=s' => sub { $opts{bar} = $_[1] },
);
view all matches for this distribution
view release on metacpan or search on metacpan
t/descriptive.t view on Meta::CPAN
# precludes => [...]
# sugar for only_one_of and all_or_none
sub is_opt {
my ($argv, $specs, $expect, $desc) = @_;
local @ARGV = @$argv;
local $Test::Builder::Level = $Test::Builder::Level + 1;
my $ok = eval {
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ($opt, $usage) = describe_options(
"test %o",
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More;
use Getopt::Long::Modern;
# regular options
{
local @ARGV = qw(-f --bar baz -Z 1 --baz 2 abc);
GetOptions(
'f|foo' => \my $foo,
'b|bar=s' => \my $bar,
'Z|baz=s' => \my @baz,
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Getopt/Long/Subcommand.pm view on Meta::CPAN
=head2 How to avoid modifying @ARGV? How to process from another array, like Getopt::Long's GetOptionsFromArray?
Instead of adding another function, you can use C<local>.
{
local @ARGV = ['--some', 'value'];
GetOptions(...);
}
# the original @ARGV is restored
=head1 HOMEPAGE
view all matches for this distribution
view release on metacpan or search on metacpan
t/parse_param.t view on Meta::CPAN
is(GM->getOpt('i'), 8, "i parsed ok");
is(GM->getOpt('f'), 3.145, "f parsed ok");
do {
local @ARGV = qw(
--stuff blah
);
dies_ok {GM->parseArgs()} 'parses errors';
my $e = Exception::Class->caught();
like($e, qr/no 'foo'/, 'Checking error');
};
GM->unacceptParam('stuff');
do {
local @ARGV = qw(
--stuff fooblah
);
dies_ok {GM->parseArgs()} 'rejects unaccepted parameter';
my $e = Exception::Class->caught();
like($e->message(), qr/Bad command-line/, 'Checking error') or diag explain $e;
view all matches for this distribution
view release on metacpan or search on metacpan
t/02.getopt.t view on Meta::CPAN
use parent 'Getopt::O2';
# Usage called?
{
local @ARGV = qw(-h);
local $override{exit} = 1;
my $cmdline = __PACKAGE__->new();
my $mock = Test::MockObject::Extends->new($cmdline);
view all matches for this distribution