view release on metacpan or search on metacpan
lib/App/MtAws/ConfigEngine.pm view on Meta::CPAN
}
}
sub parse_options
{
(my $self, local @ARGV) = @_; # we override @ARGV here, cause GetOptionsFromArray is not exported on perl 5.8.8
return { command => 'help', map { $_ => undef } qw/errors error_texts warnings warning_texts options/}
if (@ARGV && $ARGV[0] =~ /\b(help|h)\b/i);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Music/PlayTab.pm view on Meta::CPAN
use Encode;
use Clone qw(clone);
sub run {
local (@ARGV) = @_ ? @_ : @ARGV;
app_options();
binmode( STDERR, ':utf8' );
print STDOUT ("ok 1\n") if $test;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/NDTools/NDTool.pm view on Meta::CPAN
sub new {
my $self = bless {}, shift;
$self->{OPTS} = $self->defaults();
$self->{ARGV} =
[ map { decode(locale => "$_", Encode::FB_CROAK) } @_ ? @_ : @ARGV ];
$self->{TTY} = -t STDOUT;
unless (GetOptionsFromArray ($self->{ARGV}, $self->arg_opts)) {
$self->usage;
view all matches for this distribution
view release on metacpan or search on metacpan
t/arg_validation.t view on Meta::CPAN
my (
$opt, $usage, $name, $verbosity, $text,
$synopsis, $seconds, $time, $true_seconds
);
local @ARGV;
subtest '1s delta' => sub {
@ARGV = qw(1s this is the text);
( $opt, $usage, $name ) = App::Nag->validate_args;
( $verbosity, $text, $synopsis, $seconds ) =
view all matches for this distribution
view release on metacpan or search on metacpan
bin/nd-import-topology view on Meta::CPAN
# try to find a localenv if one isn't already in place.
if (!exists $ENV{PERL_LOCAL_LIB_ROOT}) {
use File::Spec;
my $localenv = File::Spec->catfile($FindBin::RealBin, 'localenv');
exec($localenv, $0, @ARGV) if -f $localenv;
$localenv = File::Spec->catfile($home, 'perl5', 'bin', 'localenv');
exec($localenv, $0, @ARGV) if -f $localenv;
die "Sorry, can't find libs required for App::Netdisco.\n"
if !exists $ENV{PERLBREW_PERL};
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Nopaste/Command.pm view on Meta::CPAN
if ($self->paste) {
use_module('Clipboard')->import;
return Clipboard->paste;
}
local @ARGV = @{ $self->extra_argv };
local $/;
return <>;
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/otrs.CreateTicket.pl view on Meta::CPAN
our $VERSION = '1.16';
print "$0 version $VERSION \n\n";
@ARGV = map { decode(locale => $_, 1) } @ARGV if -t STDIN;
binmode STDOUT, ":encoding(console_out)" if -t STDOUT;
binmode STDERR, ":encoding(console_out)" if -t STDERR;
my @TicketFields
= qw ( Title CustomerUser Queue Priority State Type Service SLA Owner Responsible );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Oozie/Deploy/Template/ttree.pm view on Meta::CPAN
return $self;
}
sub run {
my($self, @args) = @_;
local @ARGV = @args;
return $self->SUPER::run();
}
sub emit_warn {
my($self, $msg) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/PAUSE/cleanup.pm view on Meta::CPAN
my $self = shift;
my @arguments = @_;
my ( $help, $username, $password, $dump );
{
local @ARGV = @arguments;
GetOptions(
'username=s' => \$username,
'password=s' => \$password,
'dump|d' => \$dump,
'help|h|?' => \$help,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/PDoc.pm view on Meta::CPAN
# Daniel Bruder <daniel.bruder[@]gmail.com>
# WTFPL License <http://sam.zoy.org/wtfpl/>
sub main {
$_ = do{ local(@ARGV => $/) = $ARGV[0]; <> }; # Slurp the file
@opts = join " " => m/<!--\+\s*(.*?)\s*\+-->/g; # Get <!--+X+-->
@exec = join " && \\\n" => m/<!--&\s*(.*?)\s*&-->/g; # Get <!--&X&-->
@cmd = join " && \\\n" => "pandoc @opts @ARGV", @exec; # Construct cmd
exec @cmd # exec cmd
}
view all matches for this distribution
view release on metacpan or search on metacpan
use Pod::Find qw/pod_where/;
use Encode;
use Encode::Locale;
$_ = decode(locale => $_) foreach @ARGV;
binmode STDIN, ':encoding(console_in)';
binmode STDOUT, ':encoding(console_out)';
binmode STDERR, ':encoding(console_out)';
$0 = basename $0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/PPI/Dumper.pm view on Meta::CPAN
# same defaults as PPI::Dumper
sub run {
my $self = shift;
local @ARGV = @_;
my %opts = (
'm' => 0, # memaddr
'i' => 2, # indent
'P' => 0, # class
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Pinpp.pm view on Meta::CPAN
sub run {
my $class = shift;
# Load our arguments into ARGV, so we can use getopts.
local @ARGV = @_;
my %opts = (
o => '', # Output to PDF
I => 'topics' # Includes directory
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Plog.pm view on Meta::CPAN
=back
=cut
my (@arguments) = @_ ;
local @ARGV = @arguments ;
# parse command line
my $blog_id ;
my $configuration_path ;
my $temporary_directory ;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-usage-simple.t view on Meta::CPAN
my $is_path = qr/ ^ Path: \s* \K (.*) $ /x;
my $is_version = qr/ \b \d+\.\d+ $ /x;
my $is_cache_path = qr/ "_cache_path" \s+ => \K \s+ ".*" /x;
for my $case ( @cases ) {
local @ARGV = ( $case->{input}->@* );
my $input = "@ARGV";
my $out = "";
# Capture output.
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Prove/Plugin/Distributed.pm view on Meta::CPAN
sub load {
my ( $class, $p ) = @_;
my @args = @{ $p->{args} };
my $app = $p->{app_prove};
{
local @ARGV = @args;
push @ARGV, grep { /^--/ } @{ $app->{argv} };
$app->{argv} = [ grep { !/^--/ } @{ $app->{argv} } ];
Getopt::Long::Configure(qw(no_ignore_case bundling pass_through));
lib/App/Prove/Plugin/Distributed.pm view on Meta::CPAN
local $0 = $job_info; #fixes FindBin (in English $0 means $PROGRAM_NAME)
no strict; # default for Perl5
{
package main;
local @ARGV = $args ? @$args : ();
do $0; # do $0; could be enough for strict scripts
chdir($cwd);
if ($EVAL_ERROR) {
$EVAL_ERROR =~ s{\n+\z}{};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Prove/RunScripts.pm view on Meta::CPAN
my ( $self, @args ) = @_;
$self->{before} = [];
$self->{after} = [];
local @ARGV = @args;
Getopt::Long::Configure(qw(no_ignore_case bundling pass_through));
GetOptions(
'before=s@' => $self->{before},
'after=s@' => $self->{after},
) or Carp::croak('Unable to continue');
view all matches for this distribution
view release on metacpan or search on metacpan
t/001_proxy.t view on Meta::CPAN
my $f2 = fork;
if ($f2) {
local $SIG{ALRM} = sub { kill TERM => $f2 };
alarm 2;
local @ARGV = ( "http://localhost:$APP_PORT", '--port' => $PROXY_PORT );
App::ProxyThat->new->run;
} else {
die "Can't fork!\n" unless defined $f2;
view all matches for this distribution
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
view release on metacpan or search on metacpan
lib/App/Rad/Plugin/ReadLine.pm view on Meta::CPAN
my $welcome = \&_welcome;
$c->$welcome();
while($still_going) {
(my $cmd, local @ARGV) = split ' ',
_terminal->get_reply(
prompt => _shell_prompt(),
default => $DefaultCommand,
);
if (defined $cmd and $cmd ne '') {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/RecordStream/DBHandle.pm view on Meta::CPAN
my $options = shift;
my $mode = shift;
my $args = shift || \@ARGV;
my $spec = get_option_spec($mode, $options);
local @ARGV = @$args;
my $saved_settings = Getopt::Long::Configure();
Getopt::Long::Configure("pass_through");
GetOptions( %$spec );
Getopt::Long::Configure($saved_settings);
view all matches for this distribution
view release on metacpan or search on metacpan
xt/arguments.t view on Meta::CPAN
require_ok('bin/report-prereqs') or BAIL_OUT();
note('invalid parameter');
{
local @ARGV = ('--no-such-option');
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('to many arguments');
{
local @ARGV = qw(hello world);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--meta and --cpanfile');
{
local @ARGV = qw(--meta META.json --cpanfile cpanfile);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--meta and url');
{
local @ARGV = qw(--meta META.json http://example.com);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
like( $stderr, qr{\Qusage: arguments.t\E}, '... prints usage to STDERR' );
}
note('--cpanfile and url');
{
local @ARGV = qw(--cpanfile cpanfile http://example.com);
my ( $stdout, $stderr, @result ) = capture { App::ReportPrereqs::_main() };
is( $result[0], 2, '_main() returns 2' );
ok( scalar @result == 1, '... and nothing else' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/RunCron/CLI.pm view on Meta::CPAN
use App::RunCron;
sub new {
my ($class, @argv) = @_;
local @ARGV = @argv;
my $p = Getopt::Long::Parser->new(
config => [qw/posix_default no_ignore_case bundling auto_help/],
);
$p->getoptions(\my %opt, qw/
logfile=s
view all matches for this distribution
view release on metacpan or search on metacpan
t/configure_shell.t view on Meta::CPAN
return @getpwuid_ref;
};
{
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ("$tmpdir/does_not_exist");
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, "'$tmpdir/does_not_exist' returns shell from getpwuid()" );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, "Shell '$tmpdir/does_not_exist' does not exist\n", '... prints that non existing shell does not exist to STDERR' );
t/configure_shell.t view on Meta::CPAN
close $fh;
chmod 0644, $shell_1;
{
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ($shell_1);
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, "'$shell_1' (not executable) returns shell from getpwuid()" );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, "Shell '$shell_1' is not executable\n", '... prints that shell is not executable to STDERR' );
t/configure_shell.t view on Meta::CPAN
chmod 0755, $shell_1;
SKIP: {
skip "File '$shell_1' is not executable - this OS seems to require more then chmod 0755" if !-x $shell_1;
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ($shell_1);
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_1, "'$shell_1' (executable) returns '$shell_1'" );
is( $ENV{SHELL}, $shell_1, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, q{}, '... prints nothing to STDERR' );
t/configure_shell.t view on Meta::CPAN
{
my $cwd = cwd();
chdir $tmpdir;
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ('testshell');
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, q{'testshell' returns shell from getpwuid()} );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, "Shell 'testshell' is not an absolute path\n", '... prints that shell is not absolute path to STDERR' );
t/configure_shell.t view on Meta::CPAN
}
chmod 0644, $shell_from_getpwuid;
{
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ();
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, "no shell specified as argument returns '$shell_from_getpwuid' (not executable) from getpwuid()" );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, q{}, '... prints nothing to STDERR' );
}
chmod 0644, $shell_1;
{
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ($shell_1);
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, "'$shell_1' (not executbale) returns '$shell_from_getpwuid' (not executable) from getpwuid()" );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, "Shell '$shell_1' is not executable\n", "... prints that '$shell_1' is not executable to STDERR" );
t/configure_shell.t view on Meta::CPAN
{
my $cwd = cwd();
chdir $tmpdir;
local $ENV{SHELL} = '/bin/dummy';
local @ARGV = ('testshell');
my ( $stdout, $stderr, @result ) = capture { App::SSH::SwitchShell::configure_shell() };
is( $result[0], $shell_from_getpwuid, "'testshell' returns '$shell_from_getpwuid' (not executable) from getpwuid()" );
is( $ENV{SHELL}, $shell_from_getpwuid, '... SHELL env variable is set correctly' );
is( $stdout, q{}, '... prints nothing to STDOUT' );
is( $stderr, "Shell 'testshell' is not an absolute path\n", '... prints not absolute path error message to STDERR' );
view all matches for this distribution
view release on metacpan or search on metacpan
$rv || 0;
}
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;
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
view release on metacpan or search on metacpan
devdata/Menlo-CLI-Compat.v1.9022.pm.txt view on Meta::CPAN
}
sub parse_options {
my $self = shift;
local @ARGV = @{$self->{argv}};
push @ARGV, grep length, split /\s+/, $self->env('OPT');
push @ARGV, @_;
Getopt::Long::Configure("bundling");
Getopt::Long::GetOptions(
view all matches for this distribution
view release on metacpan or search on metacpan
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
return $package->resume;
}
sub current {
# hmm, wonder what the right thing to do here is
local @ARGV;
return shift()->resume;
}
sub _construct {
my ($package, %input) = @_;
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
push @specs, $k . (defined $v->{type} ? $v->{type} : '');
push @specs, $v->{store} if exists $v->{store};
$args->{$k} = $v->{default} if exists $v->{default};
}
local @ARGV = @argv; # No other way to dupe Getopt::Long
# Get the options values and return them.
# XXX Add option to allow users to set options?
if ( @specs ) {
Getopt::Long::Configure('pass_through');
view all matches for this distribution
view release on metacpan or search on metacpan
t/03cmdline.t view on Meta::CPAN
);
foreach my $argset (@cmds) {
my ($arglist, $resultset) = @$argset;
my %results = %$resultset;
local @ARGV = @$arglist;
my $app = new App::SimpleScan;
for my $method (qw(run generate warn)) {
is ${$app->$method}, $results{$method}, "$method (@{$arglist})";
}
undef $app;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Skeletor.pm view on Meta::CPAN
print "Found user options at: $saved_options_path\n";
my $json_opts = decode_json($saved_options_path->slurp);
@args = (@args, %$json_opts);
}
local @ARGV = @args;
my ($desc ,@spec) = getopt_spec;
my ($opt, $usage) = describe_options($desc, @spec, {getopt_conf=>['pass_through']});
my ($path_to_share, $tmp) = path_to_share($opt->template);
## Templates can add or override options
if($opt->template->can('extra_getopt_spec')) {
my @new_spec = (@spec, $opt->template->extra_getopt_spec);
local @ARGV = @args;
($opt, $usage) = describe_options($desc, @new_spec);
}
my %template_var_names = (
(map { $_->{name} => $opt->${\$_->{name}} } @{$usage->{options}}),
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-config.t view on Meta::CPAN
is($sr->username, 'keep_me');
is($sr->password, 'omfg');
$ENV{APP_SMOLDER_REPORT_CONF} = 'empty.conf';
$sr = App::Smolder::Report->new;
local @ARGV = (
"--username=userc",
"--password=passc",
"--server=serverc",
"--project-id=25",
"--delete",
t/02-config.t view on Meta::CPAN
ok($sr->delete);
ok(!$sr->dry_run);
ok(!$sr->quiet);
$sr = App::Smolder::Report->new;
local @ARGV = (
'--delete',
'--password=pass',
'--quiet',
'--dry-run'
);
view all matches for this distribution