Result:
found more than 1395 distributions - search limited to the first 2001 files matching your query ( run in 1.550 )


Games-FrozenBubble

 view release on metacpan or  search on metacpan

inc/My/Builder.pm  view on Meta::CPAN

    $self->depends_on('installdeps');
    my $bd = $self->{properties}->{base_dir};

    # prepare INC
    local @INC = @INC;
    local @ARGV = @{$self->args->{ARGV}};
    my $script = shift @ARGV;
    unshift @INC, (File::Spec->catdir($bd, $self->blib, 'lib'), File::Spec->catdir($bd, $self->blib, 'arch'));

    if ($script) {
      # scenario: ./Build run bin/scriptname param1 param2

 view all matches for this distribution


Ganglia-Gmetric-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Gazelle

 view release on metacpan or  search on metacpan

lib/Plack/Handler/ppport.h  view on Meta::CPAN

  $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;

lib/Plack/Handler/ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Gearman-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Gedcom

 view release on metacpan or  search on metacpan

utils/makeh  view on Meta::CPAN

use warnings;

my $Command = {
    set_version => sub {
        my ($command, $version, $date, @files) = @_;
        local ($^I, @ARGV) = ("", @files);
        while (<>) {
            s/(^\s*(?:our\s+)?\$VERSION = ")\d+\.\d+(";)/$1$version$2/;
            s/(Version )\d+\.\d+( - ).*/$1$version$2$date/;
            s/(^\s*use Gedcom(?:::\w+)*\s+)\d+\.\d+;/$1$version;/;
            print;
        }
    },
    make_readme => sub {
        my ($command) = @_;
        local @ARGV;
        while (<>) {
            print if (/NAME/        ... /^[A-Z ]+$/) =~ /^\d+$/;
            print if (/DESCRIPTION/ ... /^[A-Z ]+$/) =~ /^\d+$/;
        }
    },
    munge_readme => sub {
        my ($command) = @_;
        local @ARGV;
        while (<>) {
            next if $. < 3;
            s/^/# / if $. == 3;
            if ($. == 5) {
                my $coveralls = "https://coveralls.io";

 view all matches for this distribution


Geo-Address-Mail-Standardizer-USPS-AMS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-Coder-DAMS

 view release on metacpan or  search on metacpan

src/ppport.h  view on Meta::CPAN

  $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;

src/ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-Coder-GeocodeFarm

 view release on metacpan or  search on metacpan

xt/cover.pl  view on Meta::CPAN

    chdir '..'              or die "$!";
}

do "./Build.PL";

local @ARGV = (@ARGV, 'testcover');
do "./Build";

 view all matches for this distribution


Geo-Coder-Ja

 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;

src/ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-Coordinates-MGRS-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-Coordinates-UTM-XS

 view release on metacpan or  search on metacpan

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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)//ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {
  eval { require Devel::PPPort };
  \$@ and die "Cannot require Devel::PPPort, please install.\\n";

 view all matches for this distribution


Geo-Hash-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-IP

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-OLC-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

  $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;

ppport.h  view on Meta::CPAN

  exit 2;
}

sub strip
{
  my $self = do { local(@ARGV,$/)=($0); <> };
  my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
  $copy =~ s/^(?=\S+)/    /gms;
  $self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
  $self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {

 view all matches for this distribution


Geo-TCX

 view release on metacpan or  search on metacpan

lib/Geo/TCX.pm  view on Meta::CPAN

            my ($fh, $tmp_fname) = tempfile();
            _convert_fit_to_tcx( $fname, $tmp_fname );
            $file_to_read = $tmp_fname;
            $fname =~ s/(?i:.fit)$/.tcx/
        }
        $txt = do { local(@ARGV, $/) = $file_to_read; <> };
        $o->set_filename($fname)
    }

    $txt =~ s,\r,,g;                               # if it's a windows file
    $txt =~ s,>\s+<,><,g;

 view all matches for this distribution


Gepok

 view release on metacpan or  search on metacpan

t/certs.t  view on Meta::CPAN


    # 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


Getopt-Alt

 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


Getopt-Chain

 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


Getopt-Class

 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


Getopt-Compact-WithCmd

 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


Getopt-Complete

 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


Getopt-EX-Hashed

 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;
}

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


Getopt-EX

 view release on metacpan or  search on metacpan

lib/Getopt/EX/Module.pm  view on Meta::CPAN


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);

 view all matches for this distribution


Getopt-Guided

 view release on metacpan or  search on metacpan

t/extensions/list.t  view on Meta::CPAN

imported_ok 'getopts';

subtest 'List option specified but not used' => sub {
  plan tests => 3;

  local @ARGV = qw( -a foo -b );
  ok getopts( 'a:I,b', my %got_opts ), 'Succeeded';
  is \%got_opts, { a => 'foo', b => 1 }, 'Options properly set';
  is @ARGV, 0, '@ARGV is empty'
};

subtest 'List option repeated once' => sub {
  plan tests => 3;

  local @ARGV = qw( -I lib -a foo -c );
  ok getopts( 'a:I,c', my %got_opts ), 'Succeeded';
  is \%got_opts, { I => [ 'lib' ], a => 'foo', c => 1 }, 'Options properly set';
  is @ARGV, 0, '@ARGV is empty'
};

subtest 'List option repeated 2 times' => sub {
  plan tests => 3;

  local @ARGV = qw( -b -I lib -a foo -I local/lib/perl5 );
  ok getopts( 'I,a:b', my %got_opts ), 'Succeeded';
  is \%got_opts, { I => [ 'lib', 'local/lib/perl5' ], a => 'foo', b => 1 }, 'Options properly set';
  is @ARGV, 0, '@ARGV is empty'
};

subtest 'List option repeated 2 times; 2nd option-argument is undefined' => sub {
  plan tests => 4;

  local @ARGV = qw( -I lib -a foo -c -I );
  my %got_opts;
  like warning { ok !getopts( 'a:cI,', %got_opts ), 'Failed' }, qr/option requires an argument -- I/, 'Check warning';
  is \%got_opts, {}, '%got_opts is empty';
  is \@ARGV, [ qw( -I lib -a foo -c -I ) ], '@ARGV restored'
}

 view all matches for this distribution


Getopt-Helpful

 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


Getopt-Kingpin

 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


Getopt-Long-Complete

 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


Getopt-Long-Descriptive

 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",

t/descriptive.t  view on Meta::CPAN

}

sub is_hidden {
  my ($specs, $cmd, $text) = @_;
  eval {
    local @ARGV;
    my ($opt, $usage) = describe_options(
      "test %o",
      @$specs,
    );
    like(

t/descriptive.t  view on Meta::CPAN

  {},
  "an unrequired option"
);

{
  local @ARGV;
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ foo => "a foo option" ],
    [],
    ['bar options:'],

t/descriptive.t  view on Meta::CPAN

    "CODEISH: spacer and non-option description found",
  );
}

{
  local @ARGV;
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ foo => "a foo option" ],
    [],
    [\"bar options:\n -> they are cool"],

t/descriptive.t  view on Meta::CPAN

    "CODEISH: spacer and non-option description found",
  );
}

{
  local @ARGV;
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ 'foo'          => "foo option" ],
    [ 'bar|b'        => "bar option" ],
    [ 'string|s=s'   => "string value" ],

t/descriptive.t  view on Meta::CPAN

    "short options",
  );
}

{
  local @ARGV;
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ 'string|s=s'   => "string value" ],
    [ 'ostring|S:s'  => "optional string value" ],
    [ 'list|l=s@'    => "list of strings" ],

t/descriptive.t  view on Meta::CPAN

    "Spec ! gets a [no-] in usage output",
  );
}

{
  local @ARGV = qw(--foo FOO --baz BAZ);
  my ($c_opt, $usage) = describe_options(
    "%c %o",
    [ "foo=s", '' ],
    [ "bar=s", '', { default => 'BAR' } ],
    [ "baz=s", '', { default => 'BAZ' } ],

t/descriptive.t  view on Meta::CPAN

  is($C_opt->baz, 'BAZ', 'C_opt->foo is BAZ');
  is($s_opt->baz, 'BAZ', 's_opt->foo is BAZ');
}

{
  local @ARGV = qw(--foo);
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ "foo", '' ],
    [ "bar", '' ],
  );

t/descriptive.t  view on Meta::CPAN

  is( $opt->{bar}, undef, "entry not given is undef (exists? no guarantee)" );
  is( $opt->bar,   undef, "entry not given is undef (as method)");
}

{
  local @ARGV = qw(--get);
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ "mode" => hidden => { one_of => [
      [ "get" => "get the value"  ],
      [ "set" => "set the value" ],

t/descriptive.t  view on Meta::CPAN

  is( $opt->{set}, undef, "one_of entry not given is undef (as hash key)" );
  is( $opt->set,   undef, "one_of entry not given is undef (as method)");
}

{
  local @ARGV = qw(--foo-bar);
  my ($opt) = describe_options(
    "%c %o",
    [ "foo:s", "foo option" ],
    [ "foo-bar", "foo-bar option", { implies => 'foo' } ],
  );

t/descriptive.t  view on Meta::CPAN

  is($opt->foo_bar, 1, 'given value (checked with method)');
  is($opt->foo,     1, 'implied value (checked with method)');
}

{
  local @ARGV;
  local $Getopt::Long::Descriptive::TERM_WIDTH = 80;

  my ($opt, $usage) = describe_options(
    "test %o",
    [ foo => "a foo option" ],

t/descriptive.t  view on Meta::CPAN


  is($usage->text, $expect, 'long option description is wrapped cleanly');
}

{
  local @ARGV;
  local $Getopt::Long::Descriptive::TERM_WIDTH = 80;

  # We're testing, here, that if we "forget" the usual "%c %o" style format,
  # its assumed.
  my ($opt, $usage) = describe_options(

t/descriptive.t  view on Meta::CPAN

    [ 0,      '--no-exit' ],
  );

  for my $test (@test) {
    my $want = shift @$test;
    local @ARGV = @$test;

    my ($opt, $usage) = describe_options(@gld_args);

    is(scalar $opt->exit, $want, "(@$test) for exit!");
  }
}

{
  local @ARGV;
  my ($opt, $usage) = describe_options(
    "%c %o",
    [ foo => "x" x 80 ],
  );
  local $@;

 view all matches for this distribution


Getopt-Long-Modern

 view release on metacpan or  search on metacpan

t/getopt.t  view on Meta::CPAN

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,
	);

t/getopt.t  view on Meta::CPAN

	is_deeply \@baz, [1,2], 'option is set';
}

# no_ignore_case, permute
{
	local @ARGV = qw(--Foo abc --bar baz);
	local $SIG{__WARN__} = sub {};
	GetOptions(
		'foo'   => \my $foo,
		'bar=s' => \my $bar,
	);

t/getopt.t  view on Meta::CPAN

	is $bar, 'baz', 'option is set';
}

# bundling
{
	local @ARGV = qw(-fb baz abc);
	GetOptions(
		'f|foo'   => \my $foo,
		'b|bar=s' => \my $bar,
	);
	is_deeply \@ARGV, ['abc'], 'argument left';

t/getopt.t  view on Meta::CPAN

	is $bar, 'baz', 'option is set';
}

# gnu_compat no_getopt_compat
{
	local @ARGV = qw(+f --bar= abc);
	GetOptions(
		'f|foo'   => \my $foo,
		'b|bar=s' => \my $bar,
	);
	is_deeply \@ARGV, ['+f','abc'], 'argument left';

t/getopt.t  view on Meta::CPAN

}

# extra options
Getopt::Long::Modern->import('pass_through');
{
	local @ARGV = qw(-f --bar=baz --baz abc);
	GetOptions(
		'f|foo'   => \my $foo,
		'b|bar=s' => \my $bar,
	);
	is_deeply \@ARGV, ['--baz','abc'], 'arguments left';

 view all matches for this distribution


Getopt-Long-Subcommand

 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


( run in 1.550 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )