view release on metacpan or search on metacpan
use CPAN::Digger::CLI;
subtest recent_in_memory => sub {
my ($out, $err, $exit) = capture {
local @ARGV = ('--recent', '2', '--report', '--log', 'OFF');
CPAN::Digger::CLI::run();
};
is $err, '', 'STDERR';
my $expected_out = path('t/files/recent_in_memory.out')->slurp;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Flatten/CLI.pm view on Meta::CPAN
use Pod::Usage 'pod2usage';
use CPAN::Flatten;
sub run {
my $class = shift;
local @ARGV = @_;
GetOptions
"h|help" => sub { pod2usage(-verbose => 1) },
"version" => sub { print "CPAN::Flatten $CPAN::Flatten::VERSION\n"; exit },
"v|verbose" => \my $verbose,
"q|quiet" => \my $quiet,
view all matches for this distribution
view release on metacpan or search on metacpan
t/load-bad.t view on Meta::CPAN
use CPAN::Meta;
use File::Spec;
use IO::Dir;
sub _slurp { do { local(@ARGV,$/)=shift(@_); <> } }
delete $ENV{PERL_YAML_BACKEND};
delete $ENV{PERL_JSON_BACKEND};
delete $ENV{CPAN_META_JSON_BACKEND};
delete $ENV{CPAN_META_JSON_DECODER};
view all matches for this distribution
view release on metacpan or search on metacpan
data/tiddlers.json view on Meta::CPAN
[{"created":"20250808033718279","text":"\"\"\"\no See also:\n- It means in abcd order, i.e. alphabetical, so I can put it first in the list of topics :-)\n- [[ChartingAndPlotting]] - For Charts::ECharts or Imager, i.e. for all things to do with image...
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Catalyst.pm view on Meta::CPAN
else {
my $p = Getopt::Long::Parser->new(config => ['no_ignore_case']);
my %o;
require Text::ParseWords;
{
local @ARGV = Text::ParseWords::shellwords($optstring);
$p->getoptions(\%o, PAR::Packer->options);
}
%PAROPTS = ( %PAROPTS, %o);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/mcd view on Meta::CPAN
#~ I<Exceptions> - exits if an invalid option is passed
#~ =cut
my (@arguments) = @_ ;
local @ARGV = @arguments ;
my ($search, $browse, $html_index, $user_defined_browser, $cpan_mini_user_location) ;
unless
(
view all matches for this distribution
view release on metacpan or search on metacpan
return $tempdir;
}
subtest "defaults" => sub {
local $ENV{HOME} = config_dir;
local @ARGV = @LR_ARGS;
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'info', "default log level is info");
};
subtest "--debug" => sub {
local $ENV{HOME} = config_dir;
local @ARGV = (qw(--debug), @LR_ARGS);
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'debug', "--debug to get log level debug");
};
subtest "config: log_level" => sub {
local $ENV{HOME} = config_dir({ log_level => 'debug' });
local @ARGV = @LR_ARGS;
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'debug', "debug from config file");
};
subtest "--debug overrides config" => sub {
local $ENV{HOME} = config_dir({ log_level => 'fatal' });
local @ARGV = (qw(--debug), @LR_ARGS);
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'debug', "--debug overrides config file");
};
subtest "--log-level" => sub {
local $ENV{HOME} = config_dir;
local @ARGV = (qw(--log-level debug), @LR_ARGS);
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'debug', "--debug to get log level debug");
for my $combo (
[ qw(--debug -q) ],
[ qw(--debug --log-level debug) ],
) {
local $ENV{HOME} = config_dir;
local @ARGV = (@$combo, @LR_ARGS);
my $minicpan = eval { CPAN::Mini::App->initialize_minicpan };
like($@, qr/can't mix/, "can't use @$combo together");
};
};
for my $switch (qw(-qq --qq)) {
subtest "extra quiet with $switch" => sub {
local $ENV{HOME} = config_dir;
local @ARGV = ($switch, @LR_ARGS);
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->log_level, 'fatal', "$switch gets us log level 'fatal'");
subtest "-perl switch" => sub {
local $ENV{HOME} = config_dir;
local @ARGV = @LR_ARGS;
my $minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->{skip_perl}, 1, "'skip_perl' is true without -perl switch");
local @ARGV = ('-perl', @LR_ARGS);
$minicpan = CPAN::Mini::App->initialize_minicpan;
isa_ok($minicpan, 'CPAN::Mini');
is($minicpan->{skip_perl}, q{}, "'skip_perl' is false with -perl switch");
};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Mirror/Tiny/CLI.pm view on Meta::CPAN
}
}
sub parse_options ($self, @argv) {
local @ARGV = @argv;
my $parser = Getopt::Long::Parser->new(
config => [qw(no_auto_abbrev no_ignore_case pass_through)],
);
$parser->getoptions(
"h|help" => sub (@) { $self->cmd_help; exit },
view all matches for this distribution
view release on metacpan or search on metacpan
%meta = \@_ unless %meta;
*$PLFN = \\&${PLFN}_orig;
goto &$PLFN;
};/;
local @ARGV = ();
local $0 = $t;
my @listargs = split(' ', $info->{"make-maker"});
push @ARGV, @listargs if @listargs;
# execute the makefile
my $ok = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
t/10_prereq_computed.t view on Meta::CPAN
print $tmpfh <<EOF;
Bogus::ComputedVersion 0 1.00
EOF
close $tmpfh or die $!;
local @ARGV = $tmpfile;
local @INC = (@INC, "$FindBin::RealBin/perl5lib");
## open stdout to a variable
open OLDOUT, ">&", \*STDOUT;
close STDOUT;
view all matches for this distribution
view release on metacpan or search on metacpan
my ($guts, $ec);
sub _mod2pm { (my $mod = shift) =~ s{::}{/}g; return "$mod.pm" }
sub _path2mod { (my $pm = shift) =~ s{/}{::}g; return substr $pm, 5, -3 }
sub _mod2dist { (my $mod = shift) =~ s{::}{-}g; return $mod; }
sub _slurp { do { local (@ARGV,$/)=$_[0]; <> } }
sub capture(&) {
my $callback = shift;
my $output;
open my $fh, '>', \$output;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CPAN/Testers/ParseReport.pm view on Meta::CPAN
print STDERR $report, "\n================\n" unless $Opt{quiet};
}
if ($Opt{interactive}) {
eval { require IO::Prompt; 1; } or
die "Option '--interactive' requires IO::Prompt installed";
local @ARGV;
local $ARGV;
my $ans = IO::Prompt::prompt
(
-p => "View $guid? [onechar: ynq] ",
-d => "y",
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Cpan.pm view on Meta::CPAN
my $logger;
sub run
{
my( $class, @args ) = @_;
local @ARGV = @args;
my $return_value = HEY_IT_WORKED; # assume that things will work
$logger = $class->_init_logger;
$logger->debug( "Using logger from @{[ref $logger]}" );
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;
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
bin/psass.pl view on Meta::CPAN
# get cmd arg encoding
use Encode::Locale qw();
# convert cmd args to utf8
use Encode qw(decode encode);
# now just decode every command arguments
@ARGV = map { decode(locale => $_, 1) } @ARGV;
####################################################################################################
# config variables
####################################################################################################
view all matches for this distribution
view release on metacpan or search on metacpan
t/required.t view on Meta::CPAN
my $form = My::Form->new;
subtest 'present' => sub {
local @ARGV = qw( --file foo );
my $optargs = $form->optargs;
is(
$optargs,
array {
view all matches for this distribution
view release on metacpan or search on metacpan
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
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
$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;
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
$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;
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
lib/Canella/CLI.pm view on Meta::CPAN
use Guard;
sub parse_argv {
my ($self, $ctx, @argv) = @_;
local @ARGV = @argv;
my $p = Getopt::Long::Parser->new;
$p->configure(qw(
posix_default
no_ignore_case
auto_help
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;
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
t/18-custom-capture.t view on Meta::CPAN
} stdout => $out_fh, stderr => $err_fh;
$out_fh->close;
$err_fh->close;
is( scalar do {local (@ARGV,$/) = $temp_out; <>} , "foo\n",
"captured STDOUT to custom handle (IO::File)"
);
is( scalar do {local (@ARGV,$/) = $temp_err; <>} , "bar\n",
"captured STDERR to custom handle (IO::File)"
);
unlink $_ for $temp_out, $temp_err;
t/18-custom-capture.t view on Meta::CPAN
} stdout => $out_fh, stderr => $err_fh;
$out_fh->close;
$err_fh->close;
is( scalar do {local (@ARGV,$/) = $temp_out; <>} , "foo\n",
"captured STDOUT to custom handle (GLOB)"
);
is( scalar do {local (@ARGV,$/) = $temp_err; <>} , "bar\n",
"captured STDERR to custom handle (GLOB)"
);
unlink $_ for $temp_out, $temp_err;
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;
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
lib/Catalyst/Helper/FastCGI/ExternalServer.pm view on Meta::CPAN
}
sub _parse_args {
my ( $self, $config, @args ) = @_;
local @ARGV = ();
foreach (@args) {
my ( $key, $value ) = split /=/;
$key ||= $_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Helper/InitScript/FreeBSD.pm view on Meta::CPAN
# parse args
{
no warnings 'uninitialized';
my $opts = {};
local @ARGV = @args;
my $ret = GetOptions(
'help|?' => \$opts->{help},
'user=s' => \$opts->{user},
'group=s' => \$opts->{group},
'pidfile|p=s' => \$opts->{pidfile},
view all matches for this distribution
view release on metacpan or search on metacpan
t/auth-code-flow-IT.t view on Meta::CPAN
use FindBin qw($Bin);
use lib "$Bin/auth-code-flow-IT/MyCatalystApp/lib";
local $ENV{MOJO_LOG_LEVEL} = 'error';
local @ARGV = ('version');
my $provider_app = require "$Bin/auth-code-flow-IT/MyProviderApp/app.pl";
my $mock_oidc_client = Test::MockModule->new('OIDC::Client');
$mock_oidc_client->redefine('kid_keys' => sub { {} });
$mock_oidc_client->redefine('user_agent' => $provider_app->ua);
view all matches for this distribution
view release on metacpan or search on metacpan
t/aggregate/unit_core_script_cgi.t view on Meta::CPAN
use Test::More;
use Test::Fatal;
use Catalyst::Script::CGI;
local @ARGV;
is exception {
Catalyst::Script::CGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
}, undef, "new_with_options";
shift @TestAppToTestScripts::RUN_ARGS;
my $server = pop @TestAppToTestScripts::RUN_ARGS;
view all matches for this distribution
view release on metacpan or search on metacpan
examples/TestApp/Controller/Root.pm view on Meta::CPAN
:MenuPath('/How it works/The template')
:MenuTitle('The template')
{
my ( $self, $c ) = @_;
my $text;
{ local (@ARGV, $/) = 'TestApp/root/src/index.tt2'; $text = <> }
$c->res->content_type('text/plain');
$c->res->body($text);
}
1;
view all matches for this distribution