view release on metacpan or search on metacpan
t/lib/MockHTTPClient.pm view on Meta::CPAN
use Moo;
sub get {
my ($self, $url) = @_;
$url =~ /query=([^&]+)/;
my $xml = do {local (@ARGV, $/) = "t/$1"; <>};
{success => 1, status => 200, reason => 'OK', content => $xml,};
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/MockHTTPClient.pm view on Meta::CPAN
use Moo;
sub get {
my ($self, $url) = @_;
$url =~ /query=([^&]+)/;
my $xml = do {local (@ARGV, $/) = "t/files/$1"; <>};
{success => 1, status => 200, reason => 'OK', content => $xml,};
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Importer/RDF.pm view on Meta::CPAN
has sparql => (
is => 'ro',
lazy => 1,
trigger => sub {
my ($sparql, $ns) = ($_[1], $_[0]->ns);
$sparql = do { local (@ARGV,$/) = $sparql; <> } if $sparql =~ /^\S+$/ && -r $sparql;
my %prefix;
# guess requires prefixes (don't override existing). Don't mind false positives
$prefix{$_} = 1 for ($sparql =~ /\s([a-z][a-z0-0_-]*):/mig);
delete $prefix{$_} for ($sparql =~ /PREFIX\s+([^:]+):/mg);
$_[0]->{sparql} = join "\n", (map { $ns->SPARQL($_) } keys %prefix), $sparql;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/MockHTTPClient.pm view on Meta::CPAN
use Moo;
sub get {
my ($self, $url) = @_;
$url =~ /query=([^&]+)/;
my $xml = do {local (@ARGV, $/) = "t/files/$1"; <>};
{success => 1, status => 200, reason => 'OK', content => $xml,};
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
t/exporter.t view on Meta::CPAN
{ _id => 'foo', _xml => [ foo => {} ] },
{ _id => 'bar.xml', _xml => [ bar => {} ] },
]);
ok(-e "$dir/foo.xml" and -e "$dir/bar.xml", 'export to directory');
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo/>\n";
$out = do { local (@ARGV, $/) = "$dir/foo.xml"; <> };
is $out, $xml, 'exported to multiple files';
done_testing;
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/CavilCliTest.pm view on Meta::CPAN
sub _invoke ($self, $argv, $stdin = undef, $env = {}) {
my $cli = $self->cli;
my ($out, $err, $code) = ('', '', undef);
my $run = sub {
local @ARGV = @$argv;
# A whole copy, so a CAVIL_URL or CAVIL_API_KEY in the real environment cannot reach the code under test.
local %ENV = (%ENV, XDG_CONFIG_HOME => $self->config_dir->to_string, NO_COLOR => 1);
delete @ENV{qw(CAVIL_URL CAVIL_API_KEY)};
@ENV{keys %$env} = values %$env;
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
$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
lib/Cinnamon/CLI.pm view on Meta::CPAN
}
sub run {
my ($self, @args) = @_;
local @ARGV = @args;
my $p = Getopt::Long::Parser->new(
config => ["no_ignore_case", "pass_through"],
);
$p->getoptions(
"h|help" => \$self->{help},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/AutoDB/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/Class/AutoDB/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
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
my $main_module;
my $main_module_version;
{
local @INC = @INC;
local @ARGV = qw( NAME VERSION );
( $main_module, $main_module_version ) = @{ require './Makefile.PL' }; ## no critic ( RequireBarewordIncludes )
is $main_module, 'Class::Enumeration', 'Check main module'
}
require_ok $main_module or BAIL_OUT "Cannot load module '$main_module'";
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/Class/Scaffold/App/Test/YAMLDriven.pm view on Meta::CPAN
$testdir
);
for my $name (sort keys %file) {
note "Loading test file $name";
( my $tests_yaml =
do { local (@ARGV, $/) = $file{$name}; <> }
) =~ s/%%PID%%/sprintf("%06d", $$)/ge;
$tests_yaml =~ s/%%CNT%%/sprintf("%03d", ++(our $cnt))/ge;
# Quick regex check whether the test wants to be skipped. To use
# Load() on a test that wants to be skipped would be a bad idea as it
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Sniff/App.pm view on Meta::CPAN
=cut
sub new {
my ( $class, @args ) = @_;
local @ARGV = @args;
my $self = bless {
dirs => undef,
ignore => undef,
namespace => qr/./,
output => undef,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Class/Usul/TraitFor/UntaintedGetopts.pm view on Meta::CPAN
my $usage_opt = $config{usage_opt} ? $config{usage_opt} : 'Usage: %c %o';
@gld_conf{ @gld_attr } = @config{ @gld_attr };
$config{usage_conf } and $_set_usage_conf->( $config{usage_conf} );
$config{protect_argv } and local @ARGV = @ARGV;
$enc and @ARGV = map { decode( $enc, $_ ) } @ARGV;
$config{no_untaint } or @ARGV = map { untaint_cmdline $_ } @ARGV;
$Untainted_Argv = [ @ARGV ];
keys %{ $splitters } and @ARGV = $_split_args->( $splitters );
($opt, $Usage) = describe_options( $usage_opt, @options, \%gld_conf );
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 || 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
Cwd::chdir($iwd) || warn "$iwd: $!\n";
my($cli) = grep /^viewenv=/, @ARGV;
$venv = (split /=/, $cli)[1] if $cli;
$venv ||= '.viewenv.pl';
if (-f $venv) {
local @ARGV = grep /^\w+=/, @ARGV;
push(@ARGV, @viewenv_argv) if @viewenv_argv;
print "+ reading $venv ...\n";
eval { require $venv };
warn Msg('W', $@) if $@;
}
view all matches for this distribution
view release on metacpan or search on metacpan
use File::Find;
($EQHL, $PRHL, $STHL, $FCHL) = qw(EqInc PrevInc StBr FullCpy);
# Note: only wrapper supported functionality--possible fallback to cleartool
sub _Wrap {
local @ARGV = @_;
ClearCase::Wrapper::Extension($ARGV[0]);
no strict 'refs';
my $rc = eval { "ClearCase::Wrapper::$ARGV[0]"->(@ARGV) };
if ($@) {
chomp $@; #One extra newline to avoid dumping the stack
view all matches for this distribution
view release on metacpan or search on metacpan
# Examines supplied arg vector, returns the explicit or implicit working view.
sub ViewTag {
my $vtag;
if (@_) {
local(@ARGV) = @_;
GetOptions("tag=s" => \$vtag);
}
if (!$vtag) {
require Cwd;
my $cwd = Cwd::fastgetcwd;
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 || 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
local *Cloudflare::API::workers=sub { return bless({}, 'Cloudflare::API::Workers') };
local *Cloudflare::API::Workers::list_routes_page_response=sub {
die "stop after client creation\n"
};
{
local @ARGV=qw(--auth=wrangler --resource r2 --action list_buckets);
$error=eval { main(\@ARGV); 1 };
}
ok(!$error && $@=~/stop after client creation/,
'Wrangler authentication reaches an account-scoped request');
is($client_opt{'token'}, 'oauth-test-token', 'Wrangler token passed to client');
is($client_opt{'account_id'}, 'account-id', 'Wrangler account ID passed to client');
$ENV{'MOCK_WRANGLER_WHOAMI_JSON'}='invalid';
%client_opt=();
{
local @ARGV=qw(--auth=wrangler --account-id explicit-id --resource r2 --action list_buckets);
$error=eval { main(\@ARGV); 1 };
}
ok(!$error && $@=~/stop after client creation/,
'explicit account ID skips Wrangler account discovery');
is($client_opt{'account_id'}, 'explicit-id', 'explicit account ID takes precedence');
$ENV{'MOCK_WRANGLER_WHOAMI_JSON'}='invalid';
%client_opt=();
{
local @ARGV=qw(--auth=wrangler --resource workers --action list_routes --arg zone-id);
$error=eval { main(\@ARGV); 1 };
}
ok(!$error && $@=~/stop after client creation/,
'zone-scoped Worker route action skips Wrangler account discovery');
ok(!exists($client_opt{'account_id'}), 'zone-scoped action needs no account ID');
view all matches for this distribution
view release on metacpan or search on metacpan
buildlib/Clownfish/Build.pm view on Meta::CPAN
# the generated Makefile.
my $error = system("$^X -Mblib -MClownfish::Test -e1");
if ($error) {
print STDERR "Build succeeded, but 'use Clownfish::Test' failed.\n";
if ($ENV{AUTOMATED_TESTING}) {
my $makefile = do { local(@ARGV, $/) = 'Makefile'; <> };
print STDERR "\nContents of Makefile:\n$makefile";
}
die;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/clustericious_app.t view on Meta::CPAN
$t->get_ok('/autotest_not_found')
->status_is(404);
note $t->tx->res->text;
my($out,$err,$ret) = capture {
local @ARGV = 'routes';
local $ENV{MOJO_APP} = 'SomeService';
Clustericious::Commands->start;
};
note "[routes]\n$out" if $out;
note "[err]\n$err" if $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
$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