From: Charles McGarvey Date: Sun, 22 Mar 2020 09:46:13 +0000 (-0600) Subject: Release 0.604 X-Git-Tag: solo-0.604 X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=99be654b4b12cadc1e120541756b805e6ee697c1;p=chaz%2Fgraphql-client Release 0.604 --- diff --git a/README b/README index 6129b24..b6afcd6 100644 --- a/README +++ b/README @@ -4,14 +4,14 @@ NAME VERSION - version 0.603 + version 0.604 SYNOPSIS graphql [ [--variables JSON] | [--variable KEY=VALUE]... ] [--operation-name NAME] [--transport KEY=VALUE]... - [--[no-]unpack] [--format json|json:pretty|yaml|perl|csv|tsv|table] - [--output FILE] + [--[no-]unpack] [--filter JSONPATH] + [--format json|json:pretty|yaml|perl|csv|tsv|table] [--output FILE] graphql --version|--help|--manual @@ -128,6 +128,14 @@ OPTIONS Use --no-unpack to disable if unpack mode was enabled via GRAPHQL_CLIENT_OPTIONS. + --filter JSONPATH + + Filter the response based on a JSONPath expression. + + Requires JSON::Path. + + Alias: -p + FORMAT The argument for "--format STR" can be one of: diff --git a/graphql b/graphql index cfd2c5e..e48d299 100755 --- a/graphql +++ b/graphql @@ -9,25 +9,9 @@ BEGIN { my %fatpacked; -$fatpacked{"B/Hooks/EndOfScope.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'B_HOOKS_ENDOFSCOPE'; - package B::Hooks::EndOfScope;use strict;use warnings;our$VERSION='0.24';use 5.006001;BEGIN {use Module::Implementation 0.05;Module::Implementation::build_loader_sub(implementations=>['XS','PP' ],symbols=>['on_scope_end' ],)->()}use Sub::Exporter::Progressive 0.001006 -setup=>{exports=>['on_scope_end' ],groups=>{default=>['on_scope_end']},};1; -B_HOOKS_ENDOFSCOPE - -$fatpacked{"B/Hooks/EndOfScope/PP.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'B_HOOKS_ENDOFSCOPE_PP'; - package B::Hooks::EndOfScope::PP;use warnings;use strict;our$VERSION='0.24';use constant _PERL_VERSION=>"$]";BEGIN {if (_PERL_VERSION =~ /^5\.009/){die "By design B::Hooks::EndOfScope does not operate in pure-perl mode on perl 5.9.X\n"}elsif (_PERL_VERSION < '5.010'){require B::Hooks::EndOfScope::PP::HintHash;*on_scope_end=\&B::Hooks::EndOfScope::PP::HintHash::on_scope_end}else {require B::Hooks::EndOfScope::PP::FieldHash;*on_scope_end=\&B::Hooks::EndOfScope::PP::FieldHash::on_scope_end}}use Sub::Exporter::Progressive 0.001006 -setup=>{exports=>['on_scope_end'],groups=>{default=>['on_scope_end']},};sub __invoke_callback {local $@;eval {$_[0]->();1}or do {my$err=$@;require Carp;Carp::cluck((join ' ','A scope-end callback raised an exception, which can not be propagated when','B::Hooks::EndOfScope operates in pure-perl mode. Your program will CONTINUE','EXECUTION AS IF NOTHING HAPPENED AFTER THIS WARNING. Below is the complete','exception text, followed by a stack-trace of the callback execution:',)."\n\n$err\n\r");sleep 1 if -t *STDERR}}1; -B_HOOKS_ENDOFSCOPE_PP - -$fatpacked{"B/Hooks/EndOfScope/PP/FieldHash.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'B_HOOKS_ENDOFSCOPE_PP_FIELDHASH'; - package B::Hooks::EndOfScope::PP::FieldHash;use strict;use warnings;our$VERSION='0.24';use Tie::Hash ();use Hash::Util::FieldHash 'fieldhash';fieldhash my%hh;{package B::Hooks::EndOfScope::PP::_TieHintHashFieldHash;our@ISA=('Tie::StdHash');sub DELETE {my$ret=shift->SUPER::DELETE(@_);B::Hooks::EndOfScope::PP::__invoke_callback($_)for @$ret;$ret}}sub on_scope_end (&) {$^H |= 0x020000;tie(%hh,'B::Hooks::EndOfScope::PP::_TieHintHashFieldHash')unless tied%hh;push @{$hh{\%^H}||= []},$_[0]}1; -B_HOOKS_ENDOFSCOPE_PP_FIELDHASH - -$fatpacked{"B/Hooks/EndOfScope/PP/HintHash.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'B_HOOKS_ENDOFSCOPE_PP_HINTHASH'; - package B::Hooks::EndOfScope::PP::HintHash;use strict;use warnings;our$VERSION='0.24';use Scalar::Util ();use constant _NEEDS_MEMORY_CORRUPTION_FIXUP=>("$]" >= 5.008 and "$]" < 5.008004)? 1 : 0;use constant _PERL_VERSION=>"$]";sub on_scope_end (&) {$^H |= 0x020000 if _PERL_VERSION >= 5.008;local %^H=%^H if _PERL_VERSION < 5.008;bless \%^H,'B::Hooks::EndOfScope::PP::HintHash::__GraveyardTransport' if (_NEEDS_MEMORY_CORRUPTION_FIXUP and ref \%^H eq 'HASH');push @{$^H{sprintf '__B_H_EOS__guardstack_0X%x',Scalar::Util::refaddr(\%^H)}||= bless ([],'B::Hooks::EndOfScope::PP::_SG_STACK')},$_[0]}sub B::Hooks::EndOfScope::PP::_SG_STACK::DESTROY {B::Hooks::EndOfScope::PP::__invoke_callback($_)for @{$_[0]}}{my@Hint_Hash_Graveyard;push@Hint_Hash_Graveyard,\@Hint_Hash_Graveyard if _NEEDS_MEMORY_CORRUPTION_FIXUP;sub B::Hooks::EndOfScope::PP::HintHash::__GraveyardTransport::DESTROY {push@Hint_Hash_Graveyard,$_[0];bless $_[0],'B::Hooks::EndOfScope::PP::HintHash::__DeactivateGraveyardTransport';%{$_[0]}=()}}1; -B_HOOKS_ENDOFSCOPE_PP_HINTHASH - -$fatpacked{"B/Hooks/EndOfScope/XS.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'B_HOOKS_ENDOFSCOPE_XS'; - package B::Hooks::EndOfScope::XS;use strict;use warnings;our$VERSION='0.24';use 5.008004;use Variable::Magic 0.48 ();use Sub::Exporter::Progressive 0.001006 -setup=>{exports=>['on_scope_end'],groups=>{default=>['on_scope_end']},};my$wiz=Variable::Magic::wizard data=>sub {[$_[1]]},free=>sub {$_->()for @{$_[1]};()},local=>\undef ;sub on_scope_end (&) {$^H |= 0x020000;if (my$stack=Variable::Magic::getdata %^H,$wiz){push @{$stack},$_[0]}else {Variable::Magic::cast %^H,$wiz,$_[0]}}1; -B_HOOKS_ENDOFSCOPE_XS +$fatpacked{"Carp/Assert.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'CARP_ASSERT'; + package Carp::Assert;require 5.006;use strict qw(subs vars);use warnings;use Exporter;use vars qw(@ISA $VERSION %EXPORT_TAGS);BEGIN {$VERSION='0.21';@ISA=qw(Exporter);%EXPORT_TAGS=(NDEBUG=>[qw(assert affirm should shouldnt DEBUG)],);$EXPORT_TAGS{DEBUG}=$EXPORT_TAGS{NDEBUG};Exporter::export_tags(qw(NDEBUG DEBUG))}sub REAL_DEBUG () {1}sub NDEBUG () {0}sub noop {undef}sub noop_affirm (&;$) {undef};sub import {my$env_ndebug=exists$ENV{PERL_NDEBUG}? $ENV{PERL_NDEBUG}: $ENV{'NDEBUG'};if(grep(/^:NDEBUG$/,@_)or $env_ndebug){my$caller=caller;for my$func (grep!/^DEBUG$/,@{$EXPORT_TAGS{'NDEBUG'}}){if($func eq 'affirm'){*{$caller.'::'.$func}=\&noop_affirm}else {*{$caller.'::'.$func}=\&noop}}*{$caller.'::DEBUG'}=\&NDEBUG}else {*DEBUG=*REAL_DEBUG;Carp::Assert->_export_to_level(1,@_)}}sub _export_to_level {my$pkg=shift;my$level=shift;(undef)=shift;my$callpkg=caller($level);$pkg->export($callpkg,@_)}sub unimport {*DEBUG=*NDEBUG;push @_,':NDEBUG';goto&import}sub _fail_msg {my($name)=shift;my$msg='Assertion';$msg .= " ($name)" if defined$name;$msg .= " failed!\n";return$msg}sub assert ($;$) {unless($_[0]){require Carp;Carp::confess(_fail_msg($_[1]))}return undef}sub affirm (&;$) {unless(eval {&{$_[0]}}){my$name=$_[1];if(!defined$name){eval {require B::Deparse;$name=B::Deparse->new->coderef2text($_[0])};$name='code display non-functional on this version of Perl, sorry' if $@}require Carp;Carp::confess(_fail_msg($name))}return undef}sub should ($$) {unless($_[0]eq $_[1]){require Carp;&Carp::confess(_fail_msg("'$_[0]' should be '$_[1]'!"))}return undef}sub shouldnt ($$) {unless($_[0]ne $_[1]){require Carp;&Carp::confess(_fail_msg("'$_[0]' shouldn't be that!"))}return undef}sub shouldn't ($$) {my$env_ndebug=exists$ENV{PERL_NDEBUG}? $ENV{PERL_NDEBUG}: $ENV{'NDEBUG'};if($env_ndebug){return undef}else {shouldnt($_[0],$_[1])}}return q|You don't just EAT the largest turnip in the world!|; +CARP_ASSERT $fatpacked{"Dist/CheckConflicts.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'DIST_CHECKCONFLICTS'; package Dist::CheckConflicts;BEGIN {$Dist::CheckConflicts::AUTHORITY='cpan:DOY'}$Dist::CheckConflicts::VERSION='0.11';use strict;use warnings;use 5.006;use base 'Exporter';our@EXPORT=our@EXPORT_OK=(qw(conflicts check_conflicts calculate_conflicts dist));use Carp;use Module::Runtime 0.009 'module_notional_filename','require_module';my%CONFLICTS;my%HAS_CONFLICTS;my%DISTS;sub import {my$pkg=shift;my$for=caller;my ($conflicts,$alsos,$dist);($conflicts,@_)=_strip_opt('-conflicts'=>@_);($alsos,@_)=_strip_opt('-also'=>@_);($dist,@_)=_strip_opt('-dist'=>@_);my%conflicts=%{$conflicts || {}};for my$also (@{$alsos || []}){eval {require_module($also)}or next;if (!exists$CONFLICTS{$also}){$also .= '::Conflicts';eval {require_module($also)}or next}if (!exists$CONFLICTS{$also}){next}my%also_confs=$also->conflicts;for my$also_conf (keys%also_confs){$conflicts{$also_conf}=$also_confs{$also_conf}if!exists$conflicts{$also_conf}|| $conflicts{$also_conf}lt $also_confs{$also_conf}}}$CONFLICTS{$for}=\%conflicts;$DISTS{$for}=$dist || $for;if (grep {$_ eq ':runtime'}@_){for my$conflict (keys%conflicts){$HAS_CONFLICTS{$conflict}||= [];push @{$HAS_CONFLICTS{$conflict}},$for}for my$conflict (keys%conflicts){if (exists$INC{module_notional_filename($conflict)}){_check_version([$for],$conflict)}}@INC=grep {!(ref($_)eq 'ARRAY' && @$_ > 1 && $_->[1]==\%CONFLICTS)}@INC;unshift@INC,[sub {my ($sub,$file)=@_;(my$mod=$file)=~ s{\.pm$}{};$mod =~ s{/}{::}g;return unless$mod =~ /[\w:]+/;return unless defined$HAS_CONFLICTS{$mod};{local$HAS_CONFLICTS{$mod};require$file}_check_version($HAS_CONFLICTS{$mod},$mod);my$called;return sub {return 0 if$called;$_="1;";$called=1;return 1}},\%CONFLICTS,]}$pkg->export_to_level(1,@_)}sub _strip_opt {my ($opt,@args)=@_;my$val;for my$idx (0 .. $#args - 1){if (defined$args[$idx]&& $args[$idx]eq $opt){$val=(splice@args,$idx,2)[1];last}}return ($val,@args)}sub _check_version {my ($fors,$mod)=@_;for my$for (@$fors){my$conflict_ver=$CONFLICTS{$for}{$mod};my$version=do {no strict 'refs';${${$mod .'::'}{VERSION}}};if ($version le $conflict_ver){warn <dist;my@conflicts=$package->calculate_conflicts;return unless@conflicts;my$err="Conflicts detected for $dist:\n";for my$conflict (@conflicts){$err .= " $conflict->{package} is version " ."$conflict->{installed}, but must be greater than version " ."$conflict->{required}\n"}die$err}sub calculate_conflicts {my$package=shift;my%conflicts=$package->conflicts;my@ret;CONFLICT: for my$conflict (keys%conflicts){my$success=do {local$SIG{__WARN__}=sub {};eval {require_module($conflict)}};my$error=$@;my$file=module_notional_filename($conflict);next if not $success and $error =~ /Can't locate \Q$file\E in \@INC/;warn "Warning: $conflict did not compile" if not $success;my$installed=$success ? $conflict->VERSION : 'unknown';push@ret,{package=>$conflict,installed=>$installed,required=>$conflicts{$conflict},}if not $success or $installed le $conflicts{$conflict}}return sort {$a->{package}cmp $b->{package}}@ret}1; @@ -36,25 +20,21 @@ $fatpacked{"Dist/CheckConflicts.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n EOF DIST_CHECKCONFLICTS -$fatpacked{"Future.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FUTURE'; - package Future;use strict;use warnings;no warnings 'recursion';our$VERSION='0.43';use Carp qw();use Scalar::Util qw(weaken blessed reftype);use B qw(svref_2object);use Time::HiRes qw(gettimeofday tv_interval);require overload;require Future::Exception;our@CARP_NOT=qw(Future::Utils);use constant DEBUG=>!!$ENV{PERL_FUTURE_DEBUG};our$TIMES=DEBUG || $ENV{PERL_FUTURE_TIMES};use constant {CB_DONE=>1<<0,CB_FAIL=>1<<1,CB_CANCEL=>1<<2,CB_SELF=>1<<3,CB_RESULT=>1<<4,CB_SEQ_ONDONE=>1<<5,CB_SEQ_ONFAIL=>1<<6,CB_SEQ_IMDONE=>1<<7,CB_SEQ_IMFAIL=>1<<8,};use constant CB_ALWAYS=>CB_DONE|CB_FAIL|CB_CANCEL;sub CvNAME_FILE_LINE {my ($code)=@_;my$cv=svref_2object($code);my$name=join "::",$cv->STASH->NAME,$cv->GV->NAME;return$name unless$cv->GV->NAME eq "__ANON__";my$cop=$cv->START;$cop=$cop->next while$cop and ref$cop ne "B::COP" and ref$cop ne "B::NULL";return$cv->GV->NAME if ref$cop eq "B::NULL";sprintf "%s(%s line %d)",$cv->GV->NAME,$cop->file,$cop->line}sub _callable {my ($cb)=@_;defined$cb and (reftype($cb)eq 'CODE' || overload::Method($cb,'&{}'))}sub new {my$proto=shift;return bless {ready=>0,callbacks=>[],(DEBUG ? (do {my$at=Carp::shortmess("constructed");chomp$at;$at =~ s/\.$//;constructed_at=>$at}): ()),($TIMES ? (btime=>[gettimeofday ]): ()),},(ref$proto || $proto)}*AWAIT_CLONE=sub {shift->new};my$GLOBAL_END;END {$GLOBAL_END=1}sub DESTROY_debug {my$self=shift;return if$GLOBAL_END;return if$self->{ready}and ($self->{reported}or!$self->{failure});my$lost_at=join " line ",(caller)[1,2];if($self->{ready}and $self->{failure}){warn "${\$self->__selfstr} was $self->{constructed_at} and was lost near $lost_at with an unreported failure of: " .$self->{failure}[0]."\n"}elsif(!$self->{ready}){warn "${\$self->__selfstr} was $self->{constructed_at} and was lost near $lost_at before it was ready.\n"}}*DESTROY=\&DESTROY_debug if DEBUG;sub wrap {my$class=shift;my@values=@_;if(@values==1 and blessed$values[0]and $values[0]->isa(__PACKAGE__)){return$values[0]}else {return$class->done(@values)}}sub call {my$class=shift;my ($code,@args)=@_;my$f;eval {$f=$code->(@args);1}or $f=$class->fail($@);blessed$f and $f->isa("Future")or $f=$class->fail("Expected " .CvNAME_FILE_LINE($code)." to return a Future");return$f}sub _shortmess {my$at=Carp::shortmess($_[0]);chomp$at;$at =~ s/\.$//;return$at}sub _mark_ready {my$self=shift;$self->{ready}=1;$self->{ready_at}=_shortmess $_[0]if DEBUG;if($TIMES){$self->{rtime}=[gettimeofday ]}delete$self->{on_cancel};$_->[0]and $_->[0]->_revoke_on_cancel($_->[1])for @{$self->{revoke_when_ready}};delete$self->{revoke_when_ready};my$callbacks=delete$self->{callbacks}or return;my$cancelled=$self->{cancelled};my$fail=defined$self->{failure};my$done=!$fail &&!$cancelled;my@result=$done ? $self->get : $fail ? $self->failure : ();for my$cb (@$callbacks){my ($flags,$code)=@$cb;my$is_future=blessed($code)&& $code->isa("Future");next if$done and not($flags & CB_DONE);next if$fail and not($flags & CB_FAIL);next if$cancelled and not($flags & CB_CANCEL);$self->{reported}=1 if$fail;if($is_future){$done ? $code->done(@result): $fail ? $code->fail(@result): $code->cancel}elsif($flags & (CB_SEQ_ONDONE|CB_SEQ_ONFAIL)){my (undef,undef,$fseq)=@$cb;if(!$fseq){Carp::carp +(DEBUG ? "${\$self->__selfstr} ($self->{constructed_at})" : "${\$self->__selfstr} $self")." lost a sequence Future";next}my$f2;if($done and $flags & CB_SEQ_ONDONE or $fail and $flags & CB_SEQ_ONFAIL){if($flags & CB_SEQ_IMDONE){$fseq->done(@$code);next}elsif($flags & CB_SEQ_IMFAIL){$fseq->fail(@$code);next}my@args=(($flags & CB_SELF ? $self : ()),($flags & CB_RESULT ? @result : ()),);unless(eval {$f2=$code->(@args);1}){$fseq->fail($@);next}unless(blessed$f2 and $f2->isa("Future")){$fseq->fail("Expected " .CvNAME_FILE_LINE($code)." to return a Future");next}$fseq->on_cancel($f2)}else {$f2=$self}if($f2->is_ready){$f2->on_ready($fseq)if!$f2->{cancelled}}else {push @{$f2->{callbacks}},[CB_DONE|CB_FAIL,$fseq ];weaken($f2->{callbacks}[-1][1])}}else {$code->(($flags & CB_SELF ? $self : ()),($flags & CB_RESULT ? @result : ()),)}}}sub is_ready {my$self=shift;return$self->{ready}}*AWAIT_IS_READY=\&is_ready;sub is_done {my$self=shift;return$self->{ready}&&!$self->{failure}&&!$self->{cancelled}}sub is_failed {my$self=shift;return$self->{ready}&&!!$self->{failure}}sub is_cancelled {my$self=shift;return$self->{cancelled}}*AWAIT_IS_CANCELLED=\&is_cancelled;sub state {my$self=shift;return!$self->{ready}? "pending" : DEBUG ? $self->{ready_at}: $self->{failure}? "failed" : $self->{cancelled}? "cancelled" : "done"}sub done {my$self=shift;if(ref$self){$self->{cancelled}and return$self;$self->{ready}and Carp::croak "${\$self->__selfstr} is already ".$self->state." and cannot be ->done";$self->{subs}and Carp::croak "${\$self->__selfstr} is not a leaf Future, cannot be ->done";$self->{result}=[@_ ];$self->_mark_ready("done")}else {$self=$self->new;$self->{ready}=1;$self->{ready_at}=_shortmess "done" if DEBUG;$self->{result}=[@_ ]}return$self}*AWAIT_NEW_DONE=*AWAIT_DONE=\&done;sub fail {my$self=shift;my ($exception,@more)=@_;if(ref$exception eq "Future::Exception"){@more=($exception->category,$exception->details);$exception=$exception->message}$exception or Carp::croak "$self ->fail requires an exception that is true";if(ref$self){$self->{cancelled}and return$self;$self->{ready}and Carp::croak "${\$self->__selfstr} is already ".$self->state." and cannot be ->fail'ed";$self->{subs}and Carp::croak "${\$self->__selfstr} is not a leaf Future, cannot be ->fail'ed";$self->{failure}=[$exception,@more ];$self->_mark_ready("failed")}else {$self=$self->new;$self->{ready}=1;$self->{ready_at}=_shortmess "failed" if DEBUG;$self->{failure}=[$exception,@more ]}return$self}*AWAIT_NEW_FAIL=*AWAIT_FAIL=\&fail;sub die :method {my$self=shift;my ($exception,@more)=@_;if(!ref$exception and $exception !~ m/\n$/){$exception .= sprintf " at %s line %d\n",(caller)[1,2]}$self->fail($exception,@more)}sub on_cancel {my$self=shift;my ($code)=@_;my$is_future=blessed($code)&& $code->isa("Future");$is_future or _callable($code)or Carp::croak "Expected \$code to be callable or a Future in ->on_cancel";$self->{ready}and return$self;push @{$self->{on_cancel}},$code;if($is_future){push @{$code->{revoke_when_ready}},my$r=[$self,\$self->{on_cancel}[-1]];weaken($r->[0]);weaken($r->[1])}return$self}sub AWAIT_ON_CANCEL {my$self=shift;my ($f2)=@_;push @{$self->{on_cancel}},$f2;push @{$f2->{revoke_when_ready}},my$r=[$self,\$self->{on_cancel}[-1]];weaken($r->[0]);weaken($r->[1])}sub _revoke_on_cancel {my$self=shift;my ($ref)=@_;undef $$ref;$self->{empty_on_cancel_slots}++;my$on_cancel=$self->{on_cancel}or return;if(@$on_cancel >= 8 and $self->{empty_on_cancel_slots}>= 0.5 * @$on_cancel){my$idx=0;while($idx < @$on_cancel){defined$on_cancel->[$idx]and $idx++,next;splice @$on_cancel,$idx,1,()}$self->{empty_on_cancel_slots}=0}}sub on_ready {my$self=shift;my ($code)=@_;my$is_future=blessed($code)&& $code->isa("Future");$is_future or _callable($code)or Carp::croak "Expected \$code to be callable or a Future in ->on_ready";if($self->{ready}){my$fail=defined$self->{failure};my$done=!$fail &&!$self->{cancelled};$self->{reported}=1 if$fail;$is_future ? ($done ? $code->done($self->get): $fail ? $code->fail($self->failure): $code->cancel): $code->($self)}else {push @{$self->{callbacks}},[CB_ALWAYS|CB_SELF,$self->wrap_cb(on_ready=>$code)]}return$self}sub AWAIT_ON_READY {my$self=shift;my ($code)=@_;push @{$self->{callbacks}},[CB_ALWAYS|CB_SELF,$self->wrap_cb(on_ready=>$code)]}sub get {my$self=shift;$self->block_until_ready unless$self->{ready};if(my$failure=$self->{failure}){$self->{reported}=1;my$exception=$failure->[0];$exception=Future::Exception->new(@$failure)if @$failure > 1;!ref$exception && $exception =~ m/\n$/ ? CORE::die$exception : Carp::croak$exception}$self->{cancelled}and Carp::croak "${\$self->__selfstr} was cancelled";return$self->{result}->[0]unless wantarray;return @{$self->{result}}}*AWAIT_GET=\&get;sub await {my$self=shift;Carp::croak "$self is not yet complete and does not provide ->await"}sub block_until_ready {my$self=shift;until($self->{ready}){$self->await}return$self}sub unwrap {shift;my@values=@_;if(@values==1 and blessed$values[0]and $values[0]->isa(__PACKAGE__)){return$values[0]->get}else {return$values[0]if!wantarray;return@values}}sub on_done {my$self=shift;my ($code)=@_;my$is_future=blessed($code)&& $code->isa("Future");$is_future or _callable($code)or Carp::croak "Expected \$code to be callable or a Future in ->on_done";if($self->{ready}){return$self if$self->{failure}or $self->{cancelled};$is_future ? $code->done($self->get): $code->($self->get)}else {push @{$self->{callbacks}},[CB_DONE|CB_RESULT,$self->wrap_cb(on_done=>$code)]}return$self}sub failure {my$self=shift;$self->block_until_ready unless$self->{ready};return unless$self->{failure};$self->{reported}=1;return$self->{failure}->[0]if!wantarray;return @{$self->{failure}}}sub on_fail {my$self=shift;my ($code)=@_;my$is_future=blessed($code)&& $code->isa("Future");$is_future or _callable($code)or Carp::croak "Expected \$code to be callable or a Future in ->on_fail";if($self->{ready}){return$self if not $self->{failure};$self->{reported}=1;$is_future ? $code->fail($self->failure): $code->($self->failure)}else {push @{$self->{callbacks}},[CB_FAIL|CB_RESULT,$self->wrap_cb(on_fail=>$code)]}return$self}sub cancel {my$self=shift;return$self if$self->{ready};$self->{cancelled}++;my$on_cancel=delete$self->{on_cancel};for my$code ($on_cancel ? reverse @$on_cancel : ()){defined$code or next;my$is_future=blessed($code)&& $code->isa("Future");$is_future ? $code->cancel : $code->($self)}$self->_mark_ready("cancel");return$self}sub _sequence {my$f1=shift;my ($code,$flags)=@_;my$func=(caller 1)[3];$func =~ s/^.*:://;$flags & (CB_SEQ_IMDONE|CB_SEQ_IMFAIL)or _callable($code)or Carp::croak "Expected \$code to be callable in ->$func";if(!defined wantarray){Carp::carp "Calling ->$func in void context"}if($f1->is_ready){return$f1 if$f1->is_done and not($flags & CB_SEQ_ONDONE)or $f1->failure and not($flags & CB_SEQ_ONFAIL);if($flags & CB_SEQ_IMDONE){return Future->done(@$code)}elsif($flags & CB_SEQ_IMFAIL){return Future->fail(@$code)}my@args=(($flags & CB_SELF ? $f1 : ()),($flags & CB_RESULT ? $f1->is_done ? $f1->get : $f1->failure ? $f1->failure : (): ()),);my$fseq;unless(eval {$fseq=$code->(@args);1}){return Future->fail($@)}unless(blessed$fseq and $fseq->isa("Future")){return Future->fail("Expected " .CvNAME_FILE_LINE($code)." to return a Future")}return$fseq}my$fseq=$f1->new;$fseq->on_cancel($f1);$code=$f1->wrap_cb(sequence=>$code)unless$flags & (CB_SEQ_IMDONE|CB_SEQ_IMFAIL);push @{$f1->{callbacks}},[CB_DONE|CB_FAIL|$flags,$code,$fseq ];weaken($f1->{callbacks}[-1][2]);return$fseq}my$make_donecatchfail_sub=sub {my ($with_f,$done_code,$fail_code,@catch_list)=@_;my$func=(caller 1)[3];$func =~ s/^.*:://;!$done_code or _callable($done_code)or Carp::croak "Expected \$done_code to be callable in ->$func";!$fail_code or _callable($fail_code)or Carp::croak "Expected \$fail_code to be callable in ->$func";my%catch_handlers=@catch_list;_callable($catch_handlers{$_})or Carp::croak "Expected catch handler for '$_' to be callable in ->$func" for keys%catch_handlers;sub {my$self=shift;my@maybe_self=$with_f ? ($self): ();if(!$self->{failure}){return$self unless$done_code;return$done_code->(@maybe_self,$self->get)}else {my$name=$self->{failure}[1];if(defined$name and $catch_handlers{$name}){return$catch_handlers{$name}->(@maybe_self,$self->failure)}return$self unless$fail_code;return$fail_code->(@maybe_self,$self->failure)}}};sub then {my$self=shift;my$done_code=shift;my$fail_code=(@_ % 2)? pop : undef;my@catch_list=@_;if($done_code and!@catch_list and!$fail_code){return$self->_sequence($done_code,CB_SEQ_ONDONE|CB_RESULT)}return$self->_sequence($make_donecatchfail_sub->(0,$done_code,$fail_code,@catch_list,),CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub else {my$self=shift;my ($fail_code)=@_;return$self->_sequence($fail_code,CB_SEQ_ONFAIL|CB_RESULT)}sub catch {my$self=shift;my$fail_code=(@_ % 2)? pop : undef;my@catch_list=@_;return$self->_sequence($make_donecatchfail_sub->(0,undef,$fail_code,@catch_list,),CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub transform {my$self=shift;my%args=@_;my$xfrm_done=$args{done};my$xfrm_fail=$args{fail};return$self->_sequence(sub {my$self=shift;if(!$self->{failure}){return$self unless$xfrm_done;my@result=$xfrm_done->($self->get);return$self->new->done(@result)}else {return$self unless$xfrm_fail;my@failure=$xfrm_fail->($self->failure);return$self->new->fail(@failure)}},CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub then_with_f {my$self=shift;my$done_code=shift;my$fail_code=(@_ % 2)? pop : undef;my@catch_list=@_;if($done_code and!@catch_list and!$fail_code){return$self->_sequence($done_code,CB_SEQ_ONDONE|CB_SELF|CB_RESULT)}return$self->_sequence($make_donecatchfail_sub->(1,$done_code,$fail_code,@catch_list,),CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub then_done {my$self=shift;my (@result)=@_;return$self->_sequence(\@result,CB_SEQ_ONDONE|CB_SEQ_IMDONE)}sub then_fail {my$self=shift;my (@failure)=@_;return$self->_sequence(\@failure,CB_SEQ_ONDONE|CB_SEQ_IMFAIL)}sub else_with_f {my$self=shift;my ($fail_code)=@_;return$self->_sequence($fail_code,CB_SEQ_ONFAIL|CB_SELF|CB_RESULT)}sub else_done {my$self=shift;my (@result)=@_;return$self->_sequence(\@result,CB_SEQ_ONFAIL|CB_SEQ_IMDONE)}sub else_fail {my$self=shift;my (@failure)=@_;return$self->_sequence(\@failure,CB_SEQ_ONFAIL|CB_SEQ_IMFAIL)}sub catch_with_f {my$self=shift;my$fail_code=(@_ % 2)? pop : undef;my@catch_list=@_;return$self->_sequence($make_donecatchfail_sub->(1,undef,$fail_code,@catch_list,),CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub followed_by {my$self=shift;my ($code)=@_;return$self->_sequence($code,CB_SEQ_ONDONE|CB_SEQ_ONFAIL|CB_SELF)}sub without_cancel {my$self=shift;my$new=$self->new;$self->on_ready(sub {my$self=shift;if($self->failure){$new->fail($self->failure)}else {$new->done($self->get)}});$new->{orig}=$self;$new->on_ready(sub {undef $_[0]->{orig}});return$new}sub retain {my$self=shift;return$self->on_ready(sub {undef$self})}sub _new_convergent {shift;my ($subs)=@_;for my$sub (@$subs){blessed$sub and $sub->isa("Future")or Carp::croak "Expected a Future, got $sub"}my$self;ref($_)eq "Future" or $self=$_->new,last for @$subs;$self ||= Future->new;$self->{subs}=$subs;$self->on_cancel(sub {for my$sub (@$subs){$sub->cancel if$sub and!$sub->{ready}}});return$self}sub wait_all {my$class=shift;my@subs=@_;unless(@subs){my$self=$class->done;$self->{subs}=[];return$self}my$self=Future->_new_convergent(\@subs);my$pending=0;$_->{ready}or $pending++ for@subs;if(!$pending){$self->{result}=[@subs ];$self->_mark_ready("wait_all");return$self}weaken(my$weakself=$self);my$sub_on_ready=sub {return unless my$self=$weakself;$pending--;$pending and return;$self->{result}=[@subs ];$self->_mark_ready("wait_all")};for my$sub (@subs){$sub->{ready}or $sub->on_ready($sub_on_ready)}return$self}sub wait_any {my$class=shift;my@subs=@_;unless(@subs){my$self=$class->fail("Cannot ->wait_any with no subfutures");$self->{subs}=[];return$self}my$self=Future->_new_convergent(\@subs);my$immediate_ready;for my$sub (@subs){$sub->{ready}and $immediate_ready=$sub,last}if($immediate_ready){for my$sub (@subs){$sub->{ready}or $sub->cancel}if($immediate_ready->{failure}){$self->{failure}=[$immediate_ready->failure ]}else {$self->{result}=[$immediate_ready->get ]}$self->_mark_ready("wait_any");return$self}my$pending=0;weaken(my$weakself=$self);my$sub_on_ready=sub {return unless my$self=$weakself;return if$self->{result}or $self->{failure};return if --$pending and $_[0]->{cancelled};if($_[0]->{cancelled}){$self->{failure}=["All component futures were cancelled" ]}elsif($_[0]->{failure}){$self->{failure}=[$_[0]->failure ]}else {$self->{result}=[$_[0]->get ]}for my$sub (@subs){$sub->{ready}or $sub->cancel}$self->_mark_ready("wait_any")};for my$sub (@subs){$sub->on_ready($sub_on_ready);$pending++}return$self}sub needs_all {my$class=shift;my@subs=@_;unless(@subs){my$self=$class->done;$self->{subs}=[];return$self}my$self=Future->_new_convergent(\@subs);my$immediate_fail;for my$sub (@subs){$sub->{ready}and $sub->{failure}and $immediate_fail=$sub,last}if($immediate_fail){for my$sub (@subs){$sub->{ready}or $sub->cancel}$self->{failure}=[$immediate_fail->failure ];$self->_mark_ready("needs_all");return$self}my$pending=0;$_->{ready}or $pending++ for@subs;if(!$pending){$self->{result}=[map {$_->get}@subs ];$self->_mark_ready("needs_all");return$self}weaken(my$weakself=$self);my$sub_on_ready=sub {return unless my$self=$weakself;return if$self->{result}or $self->{failure};if($_[0]->{cancelled}){$self->{failure}=["A component future was cancelled" ];for my$sub (@subs){$sub->cancel if!$sub->{ready}}$self->_mark_ready("needs_all")}elsif(my@failure=$_[0]->failure){$self->{failure}=\@failure;for my$sub (@subs){$sub->cancel if!$sub->{ready}}$self->_mark_ready("needs_all")}else {$pending--;$pending and return;$self->{result}=[map {$_->get}@subs ];$self->_mark_ready("needs_all")}};for my$sub (@subs){$sub->{ready}or $sub->on_ready($sub_on_ready)}return$self}sub needs_any {my$class=shift;my@subs=@_;unless(@subs){my$self=$class->fail("Cannot ->needs_any with no subfutures");$self->{subs}=[];return$self}my$self=Future->_new_convergent(\@subs);my$immediate_done;my$pending=0;for my$sub (@subs){$sub->{ready}and!$sub->{failure}and $immediate_done=$sub,last;$sub->{ready}or $pending++}if($immediate_done){for my$sub (@subs){$sub->{ready}? $sub->{reported}=1 : $sub->cancel}$self->{result}=[$immediate_done->get ];$self->_mark_ready("needs_any");return$self}my$immediate_fail=1;for my$sub (@subs){$sub->{ready}or $immediate_fail=0,last}if($immediate_fail){$_->{reported}=1 for@subs;$self->{failure}=[$subs[-1]->{failure}];$self->_mark_ready("needs_any");return$self}weaken(my$weakself=$self);my$sub_on_ready=sub {return unless my$self=$weakself;return if$self->{result}or $self->{failure};return if --$pending and $_[0]->{cancelled};if($_[0]->{cancelled}){$self->{failure}=["All component futures were cancelled" ];$self->_mark_ready("needs_any")}elsif(my@failure=$_[0]->failure){$pending and return;$self->{failure}=\@failure;$self->_mark_ready("needs_any")}else {$self->{result}=[$_[0]->get ];for my$sub (@subs){$sub->cancel if!$sub->{ready}}$self->_mark_ready("needs_any")}};for my$sub (@subs){$sub->{ready}or $sub->on_ready($sub_on_ready)}return$self}sub pending_futures {my$self=shift;$self->{subs}or Carp::croak "Cannot call ->pending_futures on a non-convergent Future";return grep {not $_->{ready}}@{$self->{subs}}}sub ready_futures {my$self=shift;$self->{subs}or Carp::croak "Cannot call ->ready_futures on a non-convergent Future";return grep {$_->{ready}}@{$self->{subs}}}sub done_futures {my$self=shift;$self->{subs}or Carp::croak "Cannot call ->done_futures on a non-convergent Future";return grep {$_->{ready}and not $_->{failure}and not $_->{cancelled}}@{$self->{subs}}}sub failed_futures {my$self=shift;$self->{subs}or Carp::croak "Cannot call ->failed_futures on a non-convergent Future";return grep {$_->{ready}and $_->{failure}}@{$self->{subs}}}sub cancelled_futures {my$self=shift;$self->{subs}or Carp::croak "Cannot call ->cancelled_futures on a non-convergent Future";return grep {$_->{ready}and $_->{cancelled}}@{$self->{subs}}}sub set_label {my$self=shift;($self->{label})=@_;return$self}sub label {my$self=shift;return$self->{label}}sub __selfstr {my$self=shift;return "$self" unless defined$self->{label};return "$self (\"$self->{label}\")"}sub btime {my$self=shift;return$self->{btime}}sub rtime {my$self=shift;return$self->{rtime}}sub elapsed {my$self=shift;return undef unless defined$self->{btime}and defined$self->{rtime};return$self->{elapsed}||= tv_interval($self->{btime},$self->{rtime})}sub wrap_cb {my$self=shift;my ($op,$cb)=@_;return$cb}0x55AA; -FUTURE +$fatpacked{"Exporter/Easiest.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'EXPORTER_EASIEST'; + package Exporter::Easiest;$Exporter::Easiest::VERSION='0.18';use 5.006;use strict;use warnings;no strict 'refs';require Exporter::Easy;sub import {my$pkg=shift;my$callpkg=caller(0);@_=($callpkg,parse_spec(@_));goto&Exporter::Easy::set_export_vars}sub parse_spec {my@spec=grep {/\S/}map {split(/\s+/)}@_;my%spec;my$key="";while (@spec){my$new_key=shift@spec;my$arrow=shift@spec;$arrow="" unless defined($arrow);die "Expected '=>' not '$arrow' after $new_key" unless ($arrow eq '=>');if ($new_key =~ s/^://){push(@{$spec{TAGS}},$new_key,suck_list(\@spec))}else {$key=$new_key;if(($key =~ /^(VARS|ISA)$/ and $spec[0]=~ /^\d+$/)or ($key eq 'ALL')){$spec{$key}=shift@spec}else {$spec{$key}=suck_list(\@spec)}}}return%spec}sub suck_list {my$list=shift;my@sucked;while (@$list){if ($#$list and ($list->[1]eq '=>')){last}else {push(@sucked,shift(@$list))}}return \@sucked} +EXPORTER_EASIEST -$fatpacked{"Future/Exception.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FUTURE_EXCEPTION'; - package Future::Exception;use strict;use warnings;our$VERSION='0.43';use overload '""'=>"message",fallback=>1;sub from_future {my$class=shift;my ($f)=@_;return$class->new($f->failure)}sub new {my$class=shift;bless [@_ ],$class}sub message {shift->[0]}sub category {shift->[1]}sub details {my$self=shift;@{$self}[2..$#$self]}sub throw {my$class=shift;my ($message,$category,@details)=@_;$message =~ m/\n$/ or $message .= sprintf " at %s line %d.\n",(caller)[1,2];die$class->new($message,$category,@details)}sub as_future {my$self=shift;return Future->fail($self->message,$self->category,$self->details)}0x55AA; -FUTURE_EXCEPTION +$fatpacked{"Exporter/Easy.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'EXPORTER_EASY'; + package Exporter::Easy;$Exporter::Easy::VERSION='0.18';use 5.006;use strict;use warnings;require Exporter;use vars;sub import {my$pkg=shift;unshift(@_,scalar caller);goto&set_export_vars}sub set_export_vars {my ($callpkg,%args)=@_;my%could_export;my@will_export;my@fail;my@ok_only;my%tags;@_=();if ($args{OK_ONLY}and $args{OK}){nice_die("Can't use OK_ONLY and OK together")}my$isa=exists$args{ISA}? delete$args{ISA}: 1;my$vars=exists$args{VARS}? delete$args{VARS}: 1;if (my$tag_data=delete$args{'TAGS'}){nice_die("TAGS must be a reference to an array")unless ref($tag_data)eq 'ARRAY';add_tags($tag_data,\%tags);@could_export{map {@$_}values%tags}=()}if (my$export=delete$args{'EXPORT'}){nice_die("EXPORT must be a reference to an array")unless ref($export)eq 'ARRAY';@will_export=eval {expand_tags($export,\%tags)};nice_die("$@while building the EXPORT list in $callpkg")if $@}if (my$ok=delete$args{'OK'}){nice_die("OK must be a reference to a array")unless ref($ok)eq 'ARRAY';my@ok=eval {expand_tags($ok,\%tags)};nice_die("$@while building the \@EXPORT_OK")if $@;@could_export{@ok}=()}my$ok_only=delete$args{'OK_ONLY'};if ($ok_only){die("OK_ONLY must be a reference to a array")unless ref($ok_only)eq 'ARRAY';@ok_only=eval {expand_tags($ok_only,\%tags)};nice_die("$@while building the OK_ONLY list")if $@;@could_export{@ok_only}=()}if (my$fail=delete$args{'FAIL'}){die "FAIL must be a reference to an array" unless ref($fail)eq 'ARRAY';@fail=eval {expand_tags($fail,\%tags)};nice_die("$@while building \@EXPORT_FAIL")if $@;@could_export{@fail}=()}my@could_export=keys%could_export;if (defined(my$all=delete$args{'ALL'})){nice_die("No name supplied for ALL")unless length($all);nice_die("Cannot use '$all' for ALL, already exists")if exists$tags{$all};my%all;@all{@could_export,@will_export}=();$tags{$all}=[keys%all]}if ($vars){if (my$ref=ref($vars)){nice_die("VARS was a reference to a ".$ref." instead of an array")unless$ref eq 'ARRAY';@_=('vars',grep /^(?:\$|\@|\%)/,eval {expand_tags($vars,\%tags)});nice_die("$@while building the \@EXPORT")if $@}else {@_=('vars',grep /^(?:\$|\@|\%)/,@will_export,@could_export)}}if (%args){nice_die("Attempt to use unknown keys: ",join(", ",keys%args))}no strict 'refs';if ($isa){push(@{"$callpkg\::ISA"},"Exporter")}@{"$callpkg\::EXPORT"}=@will_export if@will_export;%{"$callpkg\::EXPORT_TAGS"}=%tags if%tags;@{"$callpkg\::EXPORT_OK"}=$ok_only ? @ok_only : @could_export;@{"$callpkg\::EXPORT_FAIL"}=@fail if@fail;if (@_ > 1){goto&vars::import}}sub nice_die {my$msg=shift;my$level=shift || 1;my ($pkg,$file,$line)=caller(1);die "$msg at $file line $line\n"}sub add_tags($;$) {my$tag_data=shift;my$tags=shift || {};my@tag_data=@$tag_data;while (@tag_data){my$tag_name=shift@tag_data || die "No name for tag";die "Tag name cannot be a reference, maybe you left out a comma" if (ref$tag_name);die "Tried to redefine tag '$tag_name'" if (exists$tags->{$tag_name});my$tag_list=shift@tag_data || die "No values for tag '$tag_name'";die "Tag values for '$tag_name' is not a reference to an array" unless ref($tag_list)eq 'ARRAY';my@symbols=eval {expand_tags($tag_list,$tags)};die "$@while building tag '$tag_name'" if $@;$tags->{$tag_name}=\@symbols}return$tags}sub expand_tags($$) {my ($string_list,$so_far)=@_;my%this_tag;for my$sym (@$string_list){my@symbols;my$remove=0;if ($sym =~ s/^!//){$remove=1}if ($sym =~ s/^://){my$sub_tag=$so_far->{$sym};die "Tried to use an unknown tag '$sym'" unless defined($sub_tag);if ($remove){delete@this_tag{@$sub_tag}}else {@this_tag{@$sub_tag}=()}}else {if ($remove){delete$this_tag{$sym}}else {$this_tag{$sym}=undef}}}return keys%this_tag}1; +EXPORTER_EASY -$fatpacked{"Future/Mutex.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FUTURE_MUTEX'; - package Future::Mutex;use strict;use warnings;use 5.010;our$VERSION='0.43';use Future;sub new {my$class=shift;my%params=@_;return bless {avail=>$params{count}// 1,queue=>[],},$class}sub enter {my$self=shift;my ($code)=@_;my$down_f;if($self->{avail}){$self->{avail}--;$down_f=Future->done}else {push @{$self->{queue}},$down_f=Future->new}my$up=sub {if(my$next_f=shift @{$self->{queue}}){$next_f->done}else {$self->{avail}++}};$down_f->then($code)->on_ready($up)}sub available {my$self=shift;return$self->{avail}}0x55AA; -FUTURE_MUTEX +$fatpacked{"Exporter/Shiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'EXPORTER_SHINY'; + package Exporter::Shiny;use 5.006001;use strict;use warnings;use Exporter::Tiny ();our$AUTHORITY='cpan:TOBYINK';our$VERSION='1.002001';sub import {my$me=shift;my$caller=caller;(my$nominal_file=$caller)=~ s(::)(/)g;$INC{"$nominal_file\.pm"}||= __FILE__;if (@_==2 and $_[0]eq -setup){my (undef,$opts)=@_;@_=@{delete($opts->{exports})|| []};if (%$opts){Exporter::Tiny::_croak('Unsupported Sub::Exporter-style options: %s',join(q[, ],sort keys %$opts),)}}ref($_)&& Exporter::Tiny::_croak('Expected sub name, got ref %s',$_)for @_;no strict qw(refs);push @{"$caller\::ISA"},'Exporter::Tiny';push @{"$caller\::EXPORT_OK"},@_}1; +EXPORTER_SHINY -$fatpacked{"Future/Queue.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FUTURE_QUEUE'; - package Future::Queue;use strict;use warnings;our$VERSION='0.43';sub new {my$class=shift;return bless {items=>[],waiters=>[],},$class}sub push :method {my$self=shift;my ($item)=@_;push @{$self->{items}},$item;(shift @{$self->{waiters}})->done if @{$self->{waiters}}}sub shift :method {my$self=shift;if(@{$self->{items}}){return Future->done(shift @{$self->{items}})}push @{$self->{waiters}},my$f=Future->new;return$f->then(sub {return Future->done(shift @{$self->{items}})})}0x55AA; -FUTURE_QUEUE - -$fatpacked{"Future/Utils.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'FUTURE_UTILS'; - package Future::Utils;use strict;use warnings;our$VERSION='0.43';use Exporter 'import';sub export_to_level {my$pkg=shift;local$Exporter::ExportLevel=1 + shift;$pkg->import(@_)}our@EXPORT_OK=qw(call call_with_escape repeat try_repeat try_repeat_until_success repeat_until_success fmap fmap_concat fmap1 fmap_scalar fmap0 fmap_void);use Carp;our@CARP_NOT=qw(Future);use Future;sub call(&) {my ($code)=@_;return Future->call($code)}sub call_with_escape(&) {my ($code)=@_;my$escape_f=Future->new;return Future->wait_any(Future->call($code,$escape_f),$escape_f,)}sub _repeat {my ($code,$return,$trialp,$cond,$sense,$is_try)=@_;my$prev=$$trialp;while(1){my$trial=$$trialp ||= Future->call($code,$prev);$prev=$trial;if(!$trial->is_ready){$return ||= $trial->new;$trial->on_ready(sub {return if $$trialp->is_cancelled;_repeat($code,$return,$trialp,$cond,$sense,$is_try)});return$return}my$stop;if(not eval {$stop=!$cond->($trial)^ $sense;1}){$return ||= $trial->new;$return->fail($@);return$return}if($stop){$return ||= $trial->new;$trial->on_done($return);$trial->on_fail($return);return$return}if(!$is_try and $trial->failure){carp "Using Future::Utils::repeat to retry a failure is deprecated; use try_repeat instead"}undef $$trialp}}sub repeat(&@) {my$code=shift;my%args=@_;defined($args{while})+ defined($args{until})==1 or defined($args{foreach})or defined($args{generate})or croak "Expected one of 'while', 'until', 'foreach' or 'generate'";if($args{foreach}){$args{generate}and croak "Cannot use both 'foreach' and 'generate'";my$array=delete$args{foreach};$args{generate}=sub {@$array ? shift @$array : ()}}if($args{generate}){my$generator=delete$args{generate};my$otherwise=delete$args{otherwise};my$done;my$orig_code=$code;$code=sub {my ($last_trial_f)=@_;my$again=my ($value)=$generator->($last_trial_f);if($again){unshift @_,$value;goto &$orig_code}$done++;if($otherwise){goto &$otherwise}else {return$last_trial_f || Future->done}};if(my$orig_while=delete$args{while}){$args{while}=sub {$orig_while->($_[0])and!$done}}elsif(my$orig_until=delete$args{until}){$args{while}=sub {!$orig_until->($_[0])and!$done}}else {$args{while}=sub {!$done}}}my$future=$args{return};my$trial;$args{while}and $future=_repeat($code,$future,\$trial,$args{while},0,$args{try});$args{until}and $future=_repeat($code,$future,\$trial,$args{until},1,$args{try});$future->on_cancel(sub {$trial->cancel});return$future}sub try_repeat(&@) {&repeat(@_,try=>1)}sub try_repeat_until_success(&@) {my$code=shift;my%args=@_;defined($args{while})or defined($args{until})and croak "Cannot pass 'while' or 'until' to try_repeat_until_success";&try_repeat($code,while=>sub {shift->failure},%args)}*repeat_until_success=\&try_repeat_until_success;sub _fmap_slot {my ($slots,undef,$code,$generator,$collect,$results,$return)=@_;SLOT: while(1){my (undef,$idx)=my@args=@_;unless($slots->[$idx]){my$item;unless(($item)=$generator->()){undef$slots->[$idx];defined and return$return for @$slots;$return ||= Future->new;$return->done(@$results);return$return}my$f=$slots->[$idx]=Future->call($code,local $_=$item);if($collect eq "array"){push @$results,my$r=[];$f->on_done(sub {@$r=@_})}elsif($collect eq "scalar"){push @$results,undef;my$r=\$results->[-1];$f->on_done(sub {$$r=$_[0]})}}my$f=$slots->[$idx];if(!$f->is_ready){$args[-1]=($return ||= $f->new);$f->on_done(sub {_fmap_slot(@args)});$f->on_fail($return);my$i=$idx + 1;while($i!=$idx){$i++;$i %= @$slots;next if defined$slots->[$i];$_[1]=$i;redo SLOT}return$return}if($f->failure){$return ||= $f->new;$return->fail($f->failure);return$return}undef$slots->[$idx]}}sub _fmap {my$code=shift;my%args=@_;my$concurrent=$args{concurrent}|| 1;my@slots;my$results=[];my$future=$args{return};my$generator;if($generator=$args{generate}){}elsif(my$array=$args{foreach}){$generator=sub {return unless @$array;shift @$array}}else {croak "Expected either 'generate' or 'foreach'"}for my$idx (0 .. $concurrent-1){$future=_fmap_slot(\@slots,$idx,$code,$generator,$args{collect},$results,$future);last if$future->is_ready}$future->on_fail(sub {!defined $_ or $_->is_ready or $_->cancel for@slots});$future->on_cancel(sub {!defined $_ or $_->is_ready or $_->cancel for@slots});return$future}sub fmap_concat(&@) {my$code=shift;my%args=@_;_fmap($code,%args,collect=>"array")->then(sub {return Future->done(map {@$_}@_)})}*fmap=\&fmap_concat;sub fmap_scalar(&@) {my$code=shift;my%args=@_;_fmap($code,%args,collect=>"scalar")}*fmap1=\&fmap_scalar;sub fmap_void(&@) {my$code=shift;my%args=@_;_fmap($code,%args,collect=>"void")}*fmap0=\&fmap_void;0x55AA; -FUTURE_UTILS +$fatpacked{"Exporter/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'EXPORTER_TINY'; + package Exporter::Tiny;use 5.006001;use strict;use warnings;no warnings qw(void once uninitialized numeric redefine);our$AUTHORITY='cpan:TOBYINK';our$VERSION='1.002001';our@EXPORT_OK=qw;sub _croak ($;@) {require Carp;my$fmt=shift;@_=sprintf($fmt,@_);goto \&Carp::croak}sub _carp ($;@) {require Carp;my$fmt=shift;@_=sprintf($fmt,@_);goto \&Carp::carp}my$_process_optlist=sub {my$class=shift;my ($global_opts,$opts,$want,$not_want)=@_;while (@$opts){my$opt=shift @{$opts};my ($name,$value)=@$opt;($name =~ m{\A\!(/.+/[msixpodual]+)\z})? do {my@not=$class->_exporter_expand_regexp($1,$value,$global_opts);++$not_want->{$_->[0]}for@not}: ($name =~ m{\A\!(.+)\z})? (++$not_want->{$1}): ($name =~ m{\A[:-](.+)\z})? push(@$opts,$class->_exporter_expand_tag($1,$value,$global_opts)): ($name =~ m{\A/.+/[msixpodual]+\z})? push(@$opts,$class->_exporter_expand_regexp($name,$value,$global_opts)): push(@$want,$opt)}};sub import {my$class=shift;my$global_opts=+{@_ && ref($_[0])eq q(HASH) ? %{+shift}: ()};$global_opts->{into}=caller unless exists$global_opts->{into};my@want;my%not_want;$global_opts->{not}=\%not_want;my@args=do {no strict qw(refs);@_ ? @_ : @{"$class\::EXPORT"}};my$opts=mkopt(\@args);$class->$_process_optlist($global_opts,$opts,\@want,\%not_want);my$permitted=$class->_exporter_permitted_regexp($global_opts);$class->_exporter_validate_opts($global_opts);for my$wanted (@want){next if$not_want{$wanted->[0]};my%symbols=$class->_exporter_expand_sub(@$wanted,$global_opts,$permitted);$class->_exporter_install_sub($_,$wanted->[1],$global_opts,$symbols{$_})for keys%symbols}}sub unimport {my$class=shift;my$global_opts=+{@_ && ref($_[0])eq q(HASH) ? %{+shift}: ()};$global_opts->{into}=caller unless exists$global_opts->{into};$global_opts->{is_unimport}=1;my@want;my%not_want;$global_opts->{not}=\%not_want;my@args=do {our%TRACKED;@_ ? @_ : keys(%{$TRACKED{$class}{$global_opts->{into}}})};my$opts=mkopt(\@args);$class->$_process_optlist($global_opts,$opts,\@want,\%not_want);my$permitted=$class->_exporter_permitted_regexp($global_opts);$class->_exporter_validate_unimport_opts($global_opts);my$expando=$class->can('_exporter_expand_sub');$expando=undef if$expando==\&_exporter_expand_sub;for my$wanted (@want){next if$not_want{$wanted->[0]};if ($wanted->[1]){_carp("Passing options to unimport '%s' makes no sense",$wanted->[0])unless (ref($wanted->[1])eq 'HASH' and not keys %{$wanted->[1]})}my%symbols=defined($expando)? $class->$expando(@$wanted,$global_opts,$permitted): ($wanted->[0]=>sub {"dummy"});$class->_exporter_uninstall_sub($_,$wanted->[1],$global_opts)for keys%symbols}}sub _exporter_validate_opts {1}sub _exporter_validate_unimport_opts {1}sub _exporter_merge_opts {my$class=shift;my ($tag_opts,$global_opts,@stuff)=@_;$tag_opts={}unless ref($tag_opts)eq q(HASH);_croak('Cannot provide an -as option for tags')if exists$tag_opts->{-as}&& ref$tag_opts->{-as}ne 'CODE';my$optlist=mkopt(\@stuff);for my$export (@$optlist){next if defined($export->[1])&& ref($export->[1])ne q(HASH);my%sub_opts=(%{$export->[1]or {}},%$tag_opts);$sub_opts{-prefix}=sprintf('%s%s',$tag_opts->{-prefix},$export->[1]{-prefix})if exists($export->[1]{-prefix})&& exists($tag_opts->{-prefix});$sub_opts{-suffix}=sprintf('%s%s',$export->[1]{-suffix},$tag_opts->{-suffix})if exists($export->[1]{-suffix})&& exists($tag_opts->{-suffix});$export->[1]=\%sub_opts}return @$optlist}sub _exporter_expand_tag {no strict qw(refs);my$class=shift;my ($name,$value,$globals)=@_;my$tags=\%{"$class\::EXPORT_TAGS"};return$class->_exporter_merge_opts($value,$globals,$tags->{$name}->($class,@_))if ref($tags->{$name})eq q(CODE);return$class->_exporter_merge_opts($value,$globals,@{$tags->{$name}})if exists$tags->{$name};return$class->_exporter_merge_opts($value,$globals,@{"$class\::EXPORT"},@{"$class\::EXPORT_OK"})if$name eq 'all';return$class->_exporter_merge_opts($value,$globals,@{"$class\::EXPORT"})if$name eq 'default';$globals->{$name}=$value || 1;return}sub _exporter_expand_regexp {no strict qw(refs);our%TRACKED;my$class=shift;my ($name,$value,$globals)=@_;my$compiled=eval("qr$name");my@possible=$globals->{is_unimport}? keys(%{$TRACKED{$class}{$globals->{into}}}): @{"$class\::EXPORT_OK"};$class->_exporter_merge_opts($value,$globals,grep /$compiled/,@possible)}sub _exporter_permitted_regexp {no strict qw(refs);my$class=shift;my$re=join "|",map quotemeta,sort {length($b)<=> length($a)or $a cmp $b}@{"$class\::EXPORT"},@{"$class\::EXPORT_OK"};qr{^(?:$re)$}ms}sub _exporter_expand_sub {my$class=shift;my ($name,$value,$globals,$permitted)=@_;$permitted ||= $class->_exporter_permitted_regexp($globals);no strict qw(refs);my$sigil="&";if ($name =~ /\A([&\$\%\@\*])(.+)\z/){$sigil=$1;$name=$2;if ($sigil eq '*'){_croak("Cannot export symbols with a * sigil")}}my$sigilname=$sigil eq '&' ? $name : "$sigil$name";if ($sigilname =~ $permitted){my$generatorprefix={'&'=>"_generate_",'$'=>"_generateScalar_",'@'=>"_generateArray_",'%'=>"_generateHash_",}->{$sigil};my$generator=$class->can("$generatorprefix$name");return$sigilname=>$class->$generator($sigilname,$value,$globals)if$generator;my$sub=$class->can($name);return$sigilname=>$sub if$sub;if ($sigil ne '&'){my$evalled=eval "\\${sigil}${class}::${name}";return$sigilname=>$evalled if$evalled}}$class->_exporter_fail(@_)}sub _exporter_fail {my$class=shift;my ($name,$value,$globals)=@_;return if$globals->{is_unimport};_croak("Could not find sub '%s' exported by %s",$name,$class)}sub _exporter_install_sub {my$class=shift;my ($name,$value,$globals,$sym)=@_;my$into=$globals->{into};my$installer=$globals->{installer}|| $globals->{exporter};$name=ref$globals->{as}? $globals->{as}->($name): ref$value->{-as}? $value->{-as}->($name): exists$value->{-as}? $value->{-as}: $name;return unless defined$name;my$sigil="&";unless (ref($name)){if ($name =~ /\A([&\$\%\@\*])(.+)\z/){$sigil=$1;$name=$2;if ($sigil eq '*'){_croak("Cannot export symbols with a * sigil")}}my ($prefix)=grep defined,$value->{-prefix},$globals->{prefix},q();my ($suffix)=grep defined,$value->{-suffix},$globals->{suffix},q();$name="$prefix$name$suffix"}my$sigilname=$sigil eq '&' ? $name : "$sigil$name";return ($$name=$sym)if ref($name)eq q(SCALAR);return ($into->{$sigilname}=$sym)if ref($into)eq q(HASH);no strict qw(refs);our%TRACKED;if (ref($sym)eq 'CODE' and exists &{"$into\::$name"}and \&{"$into\::$name"}!=$sym){my ($level)=grep defined,$value->{-replace},$globals->{replace},q(0);my$action={carp=>\&_carp,0=>\&_carp,''=>\&_carp,warn=>\&_carp,nonfatal=>\&_carp,croak=>\&_croak,fatal=>\&_croak,die=>\&_croak,}->{$level}|| sub {};$action=sub {}if$TRACKED{$class}{$into}{$sigilname};$action->($action==\&_croak ? "Refusing to overwrite existing sub '%s::%s' with sub '%s' exported by %s" : "Overwriting existing sub '%s::%s' with sub '%s' exported by %s",$into,$name,$_[0],$class,)}$TRACKED{$class}{$into}{$sigilname}=$sym;no warnings qw(prototype);$installer ? $installer->($globals,[$sigilname,$sym]): (*{"$into\::$name"}=$sym)}sub _exporter_uninstall_sub {our%TRACKED;my$class=shift;my ($name,$value,$globals,$sym)=@_;my$into=$globals->{into};ref$into and return;no strict qw(refs);my$sigil="&";if ($name =~ /\A([&\$\%\@\*])(.+)\z/){$sigil=$1;$name=$2;if ($sigil eq '*'){_croak("Cannot export symbols with a * sigil")}}my$sigilname=$sigil eq '&' ? $name : "$sigil$name";if ($sigil ne '&'){_croak("Unimporting non-code symbols not supported yet")}my$our_coderef=$TRACKED{$class}{$into}{$name};my$cur_coderef=exists(&{"$into\::$name"})? \&{"$into\::$name"}: -1;return unless$our_coderef==$cur_coderef;my$stash=\%{"$into\::"};my$old=delete$stash->{$name};my$full_name=join('::',$into,$name);for my$type (qw(SCALAR HASH ARRAY IO)){next unless defined(*{$old}{$type});*$full_name=*{$old}{$type}}delete$TRACKED{$class}{$into}{$name}}sub mkopt {my$in=shift or return [];my@out;$in=[map(($_=>ref($in->{$_})? $in->{$_}: ()),sort keys %$in)]if ref($in)eq q(HASH);for (my$i=0;$i < @$in;$i++){my$k=$in->[$i];my$v;($i==$#$in)? ($v=undef): !defined($in->[$i+1])? (++$i,($v=undef)): !ref($in->[$i+1])? ($v=undef): ($v=$in->[++$i]);push@out,[$k=>$v ]}\@out}sub mkopt_hash {my$in=shift or return;my%out=map +($_->[0]=>$_->[1]),@{mkopt($in)};\%out}1; +EXPORTER_TINY $fatpacked{"Getopt/Long.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'GETOPT_LONG'; use 5.004;use strict;use warnings;package Getopt::Long;use vars qw($VERSION);$VERSION=2.51;use vars qw($VERSION_STRING);$VERSION_STRING="2.51";use Exporter;use vars qw(@ISA @EXPORT @EXPORT_OK);@ISA=qw(Exporter);sub GetOptions(@);sub GetOptionsFromArray(@);sub GetOptionsFromString(@);sub Configure(@);sub HelpMessage(@);sub VersionMessage(@);BEGIN {@EXPORT=qw(&GetOptions $REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER);@EXPORT_OK=qw(&HelpMessage &VersionMessage &Configure &GetOptionsFromArray &GetOptionsFromString)}use vars@EXPORT,@EXPORT_OK;use vars qw($error $debug $major_version $minor_version);use vars qw($autoabbrev $getopt_compat $ignorecase $bundling $order $passthrough);use vars qw($genprefix $caller $gnu_compat $auto_help $auto_version $longprefix);my$bundling_values;sub config(@);sub ConfigDefaults();sub ParseOptionSpec($$);sub OptCtl($);sub FindOption($$$$$);sub ValidValue ($$$$$);my$requested_version=0;sub ConfigDefaults() {if (defined$ENV{"POSIXLY_CORRECT"}){$genprefix="(--|-)";$autoabbrev=0;$bundling=0;$getopt_compat=0;$order=$REQUIRE_ORDER}else {$genprefix="(--|-|\\+)";$autoabbrev=1;$bundling=0;$getopt_compat=1;$order=$PERMUTE}$debug=0;$error=0;$ignorecase=1;$passthrough=0;$gnu_compat=0;$longprefix="(--)";$bundling_values=0}sub import {my$pkg=shift;my@syms=();my@config=();my$dest=\@syms;for (@_){if ($_ eq ':config'){$dest=\@config;next}push(@$dest,$_)}local$Exporter::ExportLevel=1;push(@syms,qw(&GetOptions))if@syms;$requested_version=0;$pkg->SUPER::import(@syms);Configure(@config)if@config}($REQUIRE_ORDER,$PERMUTE,$RETURN_IN_ORDER)=(0..2);($major_version,$minor_version)=$VERSION =~ /^(\d+)\.(\d+)/;ConfigDefaults();package Getopt::Long::Parser;my$default_config=do {Getopt::Long::Configure ()};sub new {my$that=shift;my$class=ref($that)|| $that;my%atts=@_;my$self={caller_pkg=>(caller)[0]};bless ($self,$class);if (defined$atts{config}){my$save=Getopt::Long::Configure ($default_config,@{$atts{config}});$self->{settings}=Getopt::Long::Configure ($save);delete ($atts{config})}else {$self->{settings}=$default_config}if (%atts){die(__PACKAGE__.": unhandled attributes: ".join(" ",sort(keys(%atts)))."\n")}$self}sub configure {my ($self)=shift;my$save=Getopt::Long::Configure ($self->{settings},@_);$self->{settings}=Getopt::Long::Configure ($save)}sub getoptions {my ($self)=shift;return$self->getoptionsfromarray(\@ARGV,@_)}sub getoptionsfromarray {my ($self)=shift;my$save=Getopt::Long::Configure ($self->{settings});my$ret=0;$Getopt::Long::caller=$self->{caller_pkg};eval {local ($SIG{__DIE__})='DEFAULT';$ret=Getopt::Long::GetOptionsFromArray (@_)};Getopt::Long::Configure ($save);die ($@)if $@;return$ret}package Getopt::Long;use constant CTL_TYPE=>0;use constant CTL_CNAME=>1;use constant CTL_DEFAULT=>2;use constant CTL_DEST=>3;use constant CTL_DEST_SCALAR=>0;use constant CTL_DEST_ARRAY=>1;use constant CTL_DEST_HASH=>2;use constant CTL_DEST_CODE=>3;use constant CTL_AMIN=>4;use constant CTL_AMAX=>5;use constant PAT_INT=>"[-+]?_*[0-9][0-9_]*";use constant PAT_XINT=>"(?:"."[-+]?_*[1-9][0-9_]*"."|"."0x_*[0-9a-f][0-9a-f_]*"."|"."0b_*[01][01_]*"."|"."0[0-7_]*".")";use constant PAT_FLOAT=>"[-+]?"."(?=[0-9.])"."[0-9_]*"."(\.[0-9_]+)?"."([eE][-+]?[0-9_]+)?";sub GetOptions(@) {unshift(@_,\@ARGV);goto&GetOptionsFromArray}sub GetOptionsFromString(@) {my ($string)=shift;require Text::ParseWords;my$args=[Text::ParseWords::shellwords($string)];$caller ||= (caller)[0];my$ret=GetOptionsFromArray($args,@_);return ($ret,$args)if wantarray;if (@$args){$ret=0;warn("GetOptionsFromString: Excess data \"@$args\" in string \"$string\"\n")}$ret}sub GetOptionsFromArray(@) {my ($argv,@optionlist)=@_;my$argend='--';my%opctl=();my$pkg=$caller || (caller)[0];my@ret=();my%linkage;my$userlinkage;my$opt;my$prefix=$genprefix;$error='';if ($debug){local ($^W)=0;print STDERR ("Getopt::Long $Getopt::Long::VERSION_STRING ","called from package \"$pkg\".","\n ","argv: ",defined($argv)? UNIVERSAL::isa($argv,'ARRAY')? "(@$argv)" : $argv : "","\n ","autoabbrev=$autoabbrev,"."bundling=$bundling,","bundling_values=$bundling_values,","getopt_compat=$getopt_compat,","gnu_compat=$gnu_compat,","order=$order,","\n ","ignorecase=$ignorecase,","requested_version=$requested_version,","passthrough=$passthrough,","genprefix=\"$genprefix\",","longprefix=\"$longprefix\".","\n")}$userlinkage=undef;if (@optionlist && ref($optionlist[0])and UNIVERSAL::isa($optionlist[0],'HASH')){$userlinkage=shift (@optionlist);print STDERR ("=> user linkage: $userlinkage\n")if$debug}if (@optionlist && $optionlist[0]=~ /^\W+$/ &&!($optionlist[0]eq '<>' && @optionlist > 0 && ref($optionlist[1]))){$prefix=shift (@optionlist);$prefix =~ s/(\W)/\\$1/g;$prefix="([" .$prefix ."])";print STDERR ("=> prefix=\"$prefix\"\n")if$debug}%opctl=();while (@optionlist){my$opt=shift (@optionlist);unless (defined($opt)){$error .= "Undefined argument in option spec\n";next}$opt=$+ if$opt =~ /^$prefix+(.*)$/s;if ($opt eq '<>'){if ((defined$userlinkage)&&!(@optionlist > 0 && ref($optionlist[0]))&& (exists$userlinkage->{$opt})&& ref($userlinkage->{$opt})){unshift (@optionlist,$userlinkage->{$opt})}unless (@optionlist > 0 && ref($optionlist[0])&& ref($optionlist[0])eq 'CODE'){$error .= "Option spec <> requires a reference to a subroutine\n";shift (@optionlist)if@optionlist && ref($optionlist[0]);next}$linkage{'<>'}=shift (@optionlist);next}my ($name,$orig)=ParseOptionSpec ($opt,\%opctl);unless (defined$name){$error .= $orig;shift (@optionlist)if@optionlist && ref($optionlist[0]);next}if (defined$userlinkage){unless (@optionlist > 0 && ref($optionlist[0])){if (exists$userlinkage->{$orig}&& ref($userlinkage->{$orig})){print STDERR ("=> found userlinkage for \"$orig\": ","$userlinkage->{$orig}\n")if$debug;unshift (@optionlist,$userlinkage->{$orig})}else {next}}}if (@optionlist > 0 && ref($optionlist[0])){print STDERR ("=> link \"$orig\" to $optionlist[0]\n")if$debug;my$rl=ref($linkage{$orig}=shift (@optionlist));if ($rl eq "ARRAY"){$opctl{$name}[CTL_DEST]=CTL_DEST_ARRAY}elsif ($rl eq "HASH"){$opctl{$name}[CTL_DEST]=CTL_DEST_HASH}elsif ($rl eq "SCALAR" || $rl eq "REF"){}elsif ($rl eq "CODE"){}else {$error .= "Invalid option linkage for \"$opt\"\n"}}else {my$ov=$orig;$ov =~ s/\W/_/g;if ($opctl{$name}[CTL_DEST]==CTL_DEST_ARRAY){print STDERR ("=> link \"$orig\" to \@$pkg","::opt_$ov\n")if$debug;eval ("\$linkage{\$orig} = \\\@".$pkg."::opt_$ov;")}elsif ($opctl{$name}[CTL_DEST]==CTL_DEST_HASH){print STDERR ("=> link \"$orig\" to \%$pkg","::opt_$ov\n")if$debug;eval ("\$linkage{\$orig} = \\\%".$pkg."::opt_$ov;")}else {print STDERR ("=> link \"$orig\" to \$$pkg","::opt_$ov\n")if$debug;eval ("\$linkage{\$orig} = \\\$".$pkg."::opt_$ov;")}}if ($opctl{$name}[CTL_TYPE]eq 'I' && ($opctl{$name}[CTL_DEST]==CTL_DEST_ARRAY || $opctl{$name}[CTL_DEST]==CTL_DEST_HASH)){$error .= "Invalid option linkage for \"$opt\"\n"}}$error .= "GetOptionsFromArray: 1st parameter is not an array reference\n" unless$argv && UNIVERSAL::isa($argv,'ARRAY');die ($error)if$error;$error=0;if (defined($auto_version)? $auto_version : ($requested_version >= 2.3203)){if (!defined($opctl{version})){$opctl{version}=['','version',0,CTL_DEST_CODE,undef];$linkage{version}=\&VersionMessage}$auto_version=1}if (defined($auto_help)? $auto_help : ($requested_version >= 2.3203)){if (!defined($opctl{help})&&!defined($opctl{'?'})){$opctl{help}=$opctl{'?'}=['','help',0,CTL_DEST_CODE,undef];$linkage{help}=\&HelpMessage}$auto_help=1}if ($debug){my ($arrow,$k,$v);$arrow="=> ";while (($k,$v)=each(%opctl)){print STDERR ($arrow,"\$opctl{$k} = $v ",OptCtl($v),"\n");$arrow=" "}}my$goon=1;while ($goon && @$argv > 0){$opt=shift (@$argv);print STDERR ("=> arg \"",$opt,"\"\n")if$debug;if (defined($opt)&& $opt eq $argend){push (@ret,$argend)if$passthrough;last}my$tryopt=$opt;my$found;my$key;my$arg;my$ctl;($found,$opt,$ctl,$arg,$key)=FindOption ($argv,$prefix,$argend,$opt,\%opctl);if ($found){next unless defined$opt;my$argcnt=0;while (defined$arg){print STDERR ("=> cname for \"$opt\" is ")if$debug;$opt=$ctl->[CTL_CNAME];print STDERR ("\"$ctl->[CTL_CNAME]\"\n")if$debug;if (defined$linkage{$opt}){print STDERR ("=> ref(\$L{$opt}) -> ",ref($linkage{$opt}),"\n")if$debug;if (ref($linkage{$opt})eq 'SCALAR' || ref($linkage{$opt})eq 'REF'){if ($ctl->[CTL_TYPE]eq '+'){print STDERR ("=> \$\$L{$opt} += \"$arg\"\n")if$debug;if (defined ${$linkage{$opt}}){${$linkage{$opt}}+= $arg}else {${$linkage{$opt}}=$arg}}elsif ($ctl->[CTL_DEST]==CTL_DEST_ARRAY){print STDERR ("=> ref(\$L{$opt}) auto-vivified"," to ARRAY\n")if$debug;my$t=$linkage{$opt};$$t=$linkage{$opt}=[];print STDERR ("=> push(\@{\$L{$opt}, \"$arg\")\n")if$debug;push (@{$linkage{$opt}},$arg)}elsif ($ctl->[CTL_DEST]==CTL_DEST_HASH){print STDERR ("=> ref(\$L{$opt}) auto-vivified"," to HASH\n")if$debug;my$t=$linkage{$opt};$$t=$linkage{$opt}={};print STDERR ("=> \$\$L{$opt}->{$key} = \"$arg\"\n")if$debug;$linkage{$opt}->{$key}=$arg}else {print STDERR ("=> \$\$L{$opt} = \"$arg\"\n")if$debug;${$linkage{$opt}}=$arg}}elsif (ref($linkage{$opt})eq 'ARRAY'){print STDERR ("=> push(\@{\$L{$opt}, \"$arg\")\n")if$debug;push (@{$linkage{$opt}},$arg)}elsif (ref($linkage{$opt})eq 'HASH'){print STDERR ("=> \$\$L{$opt}->{$key} = \"$arg\"\n")if$debug;$linkage{$opt}->{$key}=$arg}elsif (ref($linkage{$opt})eq 'CODE'){print STDERR ("=> &L{$opt}(\"$opt\"",$ctl->[CTL_DEST]==CTL_DEST_HASH ? ", \"$key\"" : "",", \"$arg\")\n")if$debug;my$eval_error=do {local $@;local$SIG{__DIE__}='DEFAULT';eval {&{$linkage{$opt}}(Getopt::Long::CallBack->new (name=>$opt,ctl=>$ctl,opctl=>\%opctl,linkage=>\%linkage,prefix=>$prefix,),$ctl->[CTL_DEST]==CTL_DEST_HASH ? ($key): (),$arg)};$@};print STDERR ("=> die($eval_error)\n")if$debug && $eval_error ne '';if ($eval_error =~ /^!/){if ($eval_error =~ /^!FINISH\b/){$goon=0}}elsif ($eval_error ne ''){warn ($eval_error);$error++}}else {print STDERR ("Invalid REF type \"",ref($linkage{$opt}),"\" in linkage\n");die("Getopt::Long -- internal error!\n")}}elsif ($ctl->[CTL_DEST]==CTL_DEST_ARRAY){if (defined$userlinkage->{$opt}){print STDERR ("=> push(\@{\$L{$opt}}, \"$arg\")\n")if$debug;push (@{$userlinkage->{$opt}},$arg)}else {print STDERR ("=>\$L{$opt} = [\"$arg\"]\n")if$debug;$userlinkage->{$opt}=[$arg]}}elsif ($ctl->[CTL_DEST]==CTL_DEST_HASH){if (defined$userlinkage->{$opt}){print STDERR ("=> \$L{$opt}->{$key} = \"$arg\"\n")if$debug;$userlinkage->{$opt}->{$key}=$arg}else {print STDERR ("=>\$L{$opt} = {$key => \"$arg\"}\n")if$debug;$userlinkage->{$opt}={$key=>$arg}}}else {if ($ctl->[CTL_TYPE]eq '+'){print STDERR ("=> \$L{$opt} += \"$arg\"\n")if$debug;if (defined$userlinkage->{$opt}){$userlinkage->{$opt}+= $arg}else {$userlinkage->{$opt}=$arg}}else {print STDERR ("=>\$L{$opt} = \"$arg\"\n")if$debug;$userlinkage->{$opt}=$arg}}$argcnt++;last if$argcnt >= $ctl->[CTL_AMAX]&& $ctl->[CTL_AMAX]!=-1;undef($arg);if ($argcnt < $ctl->[CTL_AMIN]){if (@$argv){if (ValidValue($ctl,$argv->[0],1,$argend,$prefix)){$arg=shift(@$argv);if ($ctl->[CTL_TYPE]=~ /^[iIo]$/){$arg =~ tr/_//d;$arg=$ctl->[CTL_TYPE]eq 'o' && $arg =~ /^0/ ? oct($arg): 0+$arg}($key,$arg)=$arg =~ /^([^=]+)=(.*)/ if$ctl->[CTL_DEST]==CTL_DEST_HASH;next}warn("Value \"$$argv[0]\" invalid for option $opt\n");$error++}else {warn("Insufficient arguments for option $opt\n");$error++}}if (@$argv && ValidValue($ctl,$argv->[0],0,$argend,$prefix)){$arg=shift(@$argv);if ($ctl->[CTL_TYPE]=~ /^[iIo]$/){$arg =~ tr/_//d;$arg=$ctl->[CTL_TYPE]eq 'o' && $arg =~ /^0/ ? oct($arg): 0+$arg}($key,$arg)=$arg =~ /^([^=]+)=(.*)/ if$ctl->[CTL_DEST]==CTL_DEST_HASH;next}}}elsif ($order==$PERMUTE){my$cb;if (defined ($cb=$linkage{'<>'})){print STDERR ("=> &L{$tryopt}(\"$tryopt\")\n")if$debug;my$eval_error=do {local $@;local$SIG{__DIE__}='DEFAULT';eval {&$cb($tryopt)};$@};print STDERR ("=> die($eval_error)\n")if$debug && $eval_error ne '';if ($eval_error =~ /^!/){if ($eval_error =~ /^!FINISH\b/){$goon=0}}elsif ($eval_error ne ''){warn ($eval_error);$error++}}else {print STDERR ("=> saving \"$tryopt\" ","(not an option, may permute)\n")if$debug;push (@ret,$tryopt)}next}else {unshift (@$argv,$tryopt);return ($error==0)}}if (@ret && ($order==$PERMUTE || $passthrough)){print STDERR ("=> restoring \"",join('" "',@ret),"\"\n")if$debug;unshift (@$argv,@ret)}return ($error==0)}sub OptCtl ($) {my ($v)=@_;my@v=map {defined($_)? ($_): ("")}@$v;"[".join(",","\"$v[CTL_TYPE]\"","\"$v[CTL_CNAME]\"","\"$v[CTL_DEFAULT]\"",("\$","\@","\%","\&")[$v[CTL_DEST]|| 0],$v[CTL_AMIN]|| '',$v[CTL_AMAX]|| '',)."]"}sub ParseOptionSpec ($$) {my ($opt,$opctl)=@_;if ($opt !~ m;^ @@ -78,11 +58,11 @@ $fatpacked{"Getopt/Long.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'GET GETOPT_LONG $fatpacked{"GraphQL/Client.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'GRAPHQL_CLIENT'; - package GraphQL::Client;use warnings;use strict;use Module::Load qw(load);use Scalar::Util qw(reftype);use namespace::clean;our$VERSION='0.603';sub _croak {require Carp;goto&Carp::croak}sub _throw {GraphQL::Client::Error->throw(@_)}sub new {my$class=shift;bless {@_},$class}sub execute {my$self=shift;my ($query,$variables,$operation_name,$options)=@_;if ((reftype($operation_name)|| '')eq 'HASH'){$options=$operation_name;$operation_name=undef}my$request={query=>$query,($variables && %$variables)? (variables=>$variables): (),$operation_name ? (operationName=>$operation_name): (),};return$self->_handle_result($self->transport->execute($request,$options))}sub _handle_result {my$self=shift;my ($result)=@_;my$handle_result=sub {my$result=shift;my$resp=$result->{response};if (my$exception=$result->{error}){unshift @{$resp->{errors}},{message=>"$exception",}}if ($self->unpack){if ($resp->{errors}){_throw$resp->{errors}[0]{message},{type=>'graphql',response=>$resp,details=>$result->{details},}}return$resp->{data}}return$resp};if (eval {$result->isa('Future')}){return$result->transform(done=>sub {my$result=shift;my$resp=eval {$handle_result->($result)};if (my$err=$@){Future::Exception->throw("$err",$err->{type},$err->{response},$err->{details})}return$resp},)}else {return$handle_result->($result)}}sub url {my$self=shift;$self->{url}}sub transport_class {my$self=shift;$self->{transport_class}}sub transport {my$self=shift;$self->{transport}//= do {my$class=$self->_autodetermine_transport_class;eval {load$class};if ((my$err=$@)||!$class->can('execute')){$err ||= "Loaded $class, but it doesn't look like a proper transport.\n";warn$err if$ENV{GRAPHQL_CLIENT_DEBUG};_croak "Failed to load transport for \"${class}\""}$class->new(%$self)}}sub unpack {my$self=shift;$self->{unpack}//= 0}sub _url_protocol {my$self=shift;my$url=$self->url;my ($protocol)=$url =~ /^([^+:]+)/;return$protocol}sub _autodetermine_transport_class {my$self=shift;my$class=$self->transport_class;return _expand_class($class)if$class;my$protocol=$self->_url_protocol;_croak 'Failed to determine transport from URL' if!$protocol;$class=lc($protocol);$class =~ s/[^a-z]/_/g;return _expand_class($class)}sub _expand_class {my$class=shift;$class="GraphQL::Client::$class" unless$class =~ s/^\+//;$class}{package GraphQL::Client::Error;use warnings;use strict;use overload '""'=>\&error,fallback=>1;sub new {bless {%{$_[2]|| {}},error=>$_[1]|| 'Something happened'},$_[0]}sub error {"$_[0]->{error}"}sub type {"$_[0]->{type}"}sub throw {my$self=shift;die$self if ref$self;die$self->new(@_)}}1; + package GraphQL::Client;use warnings;use strict;use Module::Load qw(load);use Scalar::Util qw(reftype);use namespace::clean;our$VERSION='0.604';sub _croak {require Carp;goto&Carp::croak}sub _throw {GraphQL::Client::Error->throw(@_)}sub new {my$class=shift;bless {@_},$class}sub execute {my$self=shift;my ($query,$variables,$operation_name,$options)=@_;if ((reftype($operation_name)|| '')eq 'HASH'){$options=$operation_name;$operation_name=undef}my$request={query=>$query,($variables && %$variables)? (variables=>$variables): (),$operation_name ? (operationName=>$operation_name): (),};return$self->_handle_result($self->transport->execute($request,$options))}sub _handle_result {my$self=shift;my ($result)=@_;my$handle_result=sub {my$result=shift;my$resp=$result->{response};if (my$exception=$result->{error}){unshift @{$resp->{errors}},{message=>"$exception",}}if ($self->unpack){if ($resp->{errors}){_throw$resp->{errors}[0]{message},{type=>'graphql',response=>$resp,details=>$result->{details},}}return$resp->{data}}return$resp};if (eval {$result->isa('Future')}){return$result->transform(done=>sub {my$result=shift;my$resp=eval {$handle_result->($result)};if (my$err=$@){Future::Exception->throw("$err",$err->{type},$err->{response},$err->{details})}return$resp},)}else {return$handle_result->($result)}}sub url {my$self=shift;$self->{url}}sub transport_class {my$self=shift;$self->{transport_class}}sub transport {my$self=shift;$self->{transport}//= do {my$class=$self->_autodetermine_transport_class;eval {load$class};if ((my$err=$@)||!$class->can('execute')){$err ||= "Loaded $class, but it doesn't look like a proper transport.\n";warn$err if$ENV{GRAPHQL_CLIENT_DEBUG};_croak "Failed to load transport for \"${class}\""}$class->new(%$self)}}sub unpack {my$self=shift;$self->{unpack}//= 0}sub _url_protocol {my$self=shift;my$url=$self->url;my ($protocol)=$url =~ /^([^+:]+)/;return$protocol}sub _autodetermine_transport_class {my$self=shift;my$class=$self->transport_class;return _expand_class($class)if$class;my$protocol=$self->_url_protocol;_croak 'Failed to determine transport from URL' if!$protocol;$class=lc($protocol);$class =~ s/[^a-z]/_/g;return _expand_class($class)}sub _expand_class {my$class=shift;$class="GraphQL::Client::$class" unless$class =~ s/^\+//;$class}{package GraphQL::Client::Error;use warnings;use strict;use overload '""'=>\&error,fallback=>1;sub new {bless {%{$_[2]|| {}},error=>$_[1]|| 'Something happened'},$_[0]}sub error {"$_[0]->{error}"}sub type {"$_[0]->{type}"}sub throw {my$self=shift;die$self if ref$self;die$self->new(@_)}}1; GRAPHQL_CLIENT $fatpacked{"GraphQL/Client/CLI.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'GRAPHQL_CLIENT_CLI'; - package GraphQL::Client::CLI;use warnings;use strict;use Encode qw(decode);use Getopt::Long 2.39 qw(GetOptionsFromArray);use GraphQL::Client;use JSON::MaybeXS;use Text::ParseWords;use namespace::clean;our$VERSION='0.603';my$JSON=JSON::MaybeXS->new(canonical=>1);sub _croak {require Carp;goto&Carp::croak}sub new {my$class=shift;bless {},$class}sub main {my$self=shift;$self=$self->new if!ref$self;my$options=eval {$self->_get_options(@_)};if (my$err=$@){print STDERR$err;_pod2usage(2)}if ($options->{version}){print "graphql $VERSION\n";exit 0}if ($options->{help}){_pod2usage(-exitval=>0,-verbose=>99,-sections=>[qw(NAME SYNOPSIS OPTIONS)])}if ($options->{manual}){_pod2usage(-exitval=>0,-verbose=>2)}my$url=$options->{url};if (!$url){print STDERR "The or --url option argument is required.\n";_pod2usage(2)}my$variables=$options->{variables};my$query=$options->{query};my$operation_name=$options->{operation_name};my$unpack=$options->{unpack};my$outfile=$options->{outfile};my$format=$options->{format};my$transport=$options->{transport};my$client=GraphQL::Client->new(url=>$url);eval {$client->transport};if (my$err=$@){warn$err if$ENV{GRAPHQL_CLIENT_DEBUG};print STDERR "Could not construct a transport for URL: $url\n";print STDERR "Is this URL correct?\n";_pod2usage(2)}if ($query eq '-'){print STDERR "Interactive mode engaged! Waiting for a query on ...\n" if -t STDIN;binmode(STDIN,'encoding(UTF-8)');$query=do {local $/;}}my$resp=$client->execute($query,$variables,$operation_name,$transport);my$err=$resp->{errors};$unpack=0 if$err;my$data=$unpack ? $resp->{data}: $resp;if ($outfile){open(my$out,'>',$outfile)or die "Open $outfile failed: $!";*STDOUT=$out}binmode(STDOUT,'encoding(UTF-8)');_print_data($data,$format);exit($unpack && $err ? 1 : 0)}sub _get_options {my$self=shift;my@args=@_;unshift@args,shellwords($ENV{GRAPHQL_CLIENT_OPTIONS}|| '');@args=map {decode('UTF-8',$_)}@args if grep {/\P{ASCII}/}@args;my%options=(format=>'json:pretty',unpack=>0,);GetOptionsFromArray(\@args,'version'=>\$options{version},'help|h|?'=>\$options{help},'manual|man'=>\$options{manual},'url|u=s'=>\$options{url},'query|mutation=s'=>\$options{query},'variables|vars|V=s'=>\$options{variables},'variable|var|d=s%'=>\$options{variables},'operation-name|n=s'=>\$options{operation_name},'transport|t=s%'=>\$options{transport},'format|f=s'=>\$options{format},'unpack!'=>\$options{unpack},'output|o=s'=>\$options{outfile},)or _pod2usage(2);$options{url}=shift@args if!$options{url};$options{query}=shift@args if!$options{query};$options{query}||= '-';my$transport=eval {_expand_vars($options{transport})};die "Two or more --transport keys are incompatible.\n" if $@;if (ref$options{variables}){$options{variables}=eval {_expand_vars($options{variables})};die "Two or more --variable keys are incompatible.\n" if $@}elsif ($options{variables}){$options{variables}=eval {$JSON->decode($options{variables})};die "The --variables JSON does not parse.\n" if $@}return \%options}sub _stringify {my ($item)=@_;if (ref($item)eq 'ARRAY'){my$first=@$item && $item->[0];return join(',',@$item)if!ref($first);return join(',',map {$JSON->encode($_)}@$item)}return$JSON->encode($item)if ref($item)eq 'HASH';return$item}sub _print_data {my ($data,$format)=@_;$format=lc($format || 'json:pretty');if ($format eq 'json' || $format eq 'json:pretty'){my%opts=(allow_nonref=>1,canonical=>1);$opts{pretty}=1 if$format eq 'json:pretty';print JSON::MaybeXS->new(%opts)->encode($data)}elsif ($format eq 'yaml'){eval {require YAML}or die "Missing dependency: YAML\n";print YAML::Dump($data)}elsif ($format eq 'csv' || $format eq 'tsv' || $format eq 'table'){my$sep=$format eq 'tsv' ? "\t" : ',';my$unpacked=$data;$unpacked=$data->{data}if$data && $data->{data};my@columns;my$rows=[];if (keys %$unpacked==1){my ($val)=values %$unpacked;if (ref$val eq 'ARRAY'){my$first=$val->[0];if ($first && ref$first eq 'HASH'){@columns=sort keys %$first;$rows=[map {[map {_stringify($_)}@{$_}{@columns}]}@$val ]}elsif ($first){@columns=keys %$unpacked;$rows=[map {[map {_stringify($_)}$_]}@$val]}}}if (@columns){if ($format eq 'table'){eval {require Text::Table::Any}or die "Missing dependency: Text::Table::Any\n";my$table=Text::Table::Any::table(header_row=>1,rows=>[[@columns],@$rows],backend=>$ENV{PERL_TEXT_TABLE},);print$table}else {eval {require Text::CSV}or die "Missing dependency: Text::CSV\n";my$csv=Text::CSV->new({binary=>1,sep=>$sep,eol=>$/});$csv->print(*STDOUT,[@columns]);for my$row (@$rows){$csv->print(*STDOUT,$row)}}}else {_print_data($data);print STDERR sprintf("Error: Response could not be formatted as %s.\n",uc($format));exit 3}}elsif ($format eq 'perl'){eval {require Data::Dumper}or die "Missing dependency: Data::Dumper\n";print Data::Dumper::Dumper($data)}else {print STDERR "Error: Format not supported: $format\n";_print_data($data);exit 3}}sub _parse_path {my$path=shift;my@path;my@segments=map {split(/\./,$_)}split(/(\[[^\.\]]+\])\.?/,$path);for my$segment (@segments){if ($segment =~ /\[([^\.\]]+)\]/){$path[-1]{type}='ARRAY' if@path;push@path,{name=>$1,index=>1,}}else {$path[-1]{type}='HASH' if@path;push@path,{name=>$segment,}}}return \@path}sub _expand_vars {my$vars=shift;my$root={};while (my ($key,$value)=each %$vars){my$parsed_path=_parse_path($key);my$curr=$root;for my$segment (@$parsed_path){my$name=$segment->{name};my$type=$segment->{type}|| '';my$next=$type eq 'HASH' ? {}: $type eq 'ARRAY' ? []: $value;if (ref$curr eq 'HASH'){_croak 'Conflicting keys' if$segment->{index};if (defined$curr->{$name}){_croak 'Conflicting keys' if$type ne ref$curr->{$name};$next=$curr->{$name}}else {$curr->{$name}=$next}}elsif (ref$curr eq 'ARRAY'){_croak 'Conflicting keys' if!$segment->{index};if (defined$curr->[$name]){_croak 'Conflicting keys' if$type ne ref$curr->[$name];$next=$curr->[$name]}else {$curr->[$name]=$next}}else {_croak 'Conflicting keys'}$curr=$next}}return$root}sub _pod2usage {eval {require Pod::Usage};if ($@){my$ref=$VERSION eq '999.999' ? 'master' : "v$VERSION";my$exit=(@_==1 && $_[0]=~ /^\d+$/ && $_[0])// (@_ % 2==0 && {@_}->{'-exitval'})// 2;print STDERR <new(canonical=>1);sub _croak {require Carp;goto&Carp::croak}sub new {my$class=shift;bless {},$class}sub main {my$self=shift;$self=$self->new if!ref$self;my$options=eval {$self->_get_options(@_)};if (my$err=$@){print STDERR$err;_pod2usage(2)}if ($options->{version}){print "graphql $VERSION\n";exit 0}if ($options->{help}){_pod2usage(-exitval=>0,-verbose=>99,-sections=>[qw(NAME SYNOPSIS OPTIONS)])}if ($options->{manual}){_pod2usage(-exitval=>0,-verbose=>2)}my$url=$options->{url};if (!$url){print STDERR "The or --url option argument is required.\n";_pod2usage(2)}my$variables=$options->{variables};my$query=$options->{query};my$operation_name=$options->{operation_name};my$unpack=$options->{unpack};my$outfile=$options->{outfile};my$format=$options->{format};my$transport=$options->{transport};my$client=GraphQL::Client->new(url=>$url);eval {$client->transport};if (my$err=$@){warn$err if$ENV{GRAPHQL_CLIENT_DEBUG};print STDERR "Could not construct a transport for URL: $url\n";print STDERR "Is this URL correct?\n";_pod2usage(2)}if ($query eq '-'){print STDERR "Interactive mode engaged! Waiting for a query on ...\n" if -t STDIN;binmode(STDIN,'encoding(UTF-8)');$query=do {local $/;}}my$resp=$client->execute($query,$variables,$operation_name,$transport);my$err=$resp->{errors};$unpack=0 if$err;my$data=$unpack ? $resp->{data}: $resp;if ($outfile){open(my$out,'>',$outfile)or die "Open $outfile failed: $!";*STDOUT=$out}if (my$filter=$options->{filter}){eval {require JSON::Path::Evaluator}or die "Missing dependency: JSON::Path\n";my@values=JSON::Path::Evaluator::evaluate_jsonpath($data,$filter);if (@values==1){$data=$values[0]}else {$data=\@values}}binmode(STDOUT,'encoding(UTF-8)');_print_data($data,$format);exit($unpack && $err ? 1 : 0)}sub _get_options {my$self=shift;my@args=@_;unshift@args,shellwords($ENV{GRAPHQL_CLIENT_OPTIONS}|| '');@args=map {decode('UTF-8',$_)}@args if grep {/\P{ASCII}/}@args;my%options=(format=>'json:pretty',unpack=>0,);GetOptionsFromArray(\@args,'version'=>\$options{version},'help|h|?'=>\$options{help},'manual|man'=>\$options{manual},'url|u=s'=>\$options{url},'query|mutation=s'=>\$options{query},'variables|vars|V=s'=>\$options{variables},'variable|var|d=s%'=>\$options{variables},'operation-name|n=s'=>\$options{operation_name},'transport|t=s%'=>\$options{transport},'format|f=s'=>\$options{format},'filter|p=s'=>\$options{filter},'unpack!'=>\$options{unpack},'output|o=s'=>\$options{outfile},)or _pod2usage(2);$options{url}=shift@args if!$options{url};$options{query}=shift@args if!$options{query};$options{query}||= '-';my$transport=eval {_expand_vars($options{transport})};die "Two or more --transport keys are incompatible.\n" if $@;if (ref$options{variables}){$options{variables}=eval {_expand_vars($options{variables})};die "Two or more --variable keys are incompatible.\n" if $@}elsif ($options{variables}){$options{variables}=eval {$JSON->decode($options{variables})};die "The --variables JSON does not parse.\n" if $@}return \%options}sub _stringify {my ($item)=@_;if (ref($item)eq 'ARRAY'){my$first=@$item && $item->[0];return join(',',@$item)if!ref($first);return join(',',map {$JSON->encode($_)}@$item)}return$JSON->encode($item)if ref($item)eq 'HASH';return$item}sub _print_data {my ($data,$format)=@_;$format=lc($format || 'json:pretty');if ($format eq 'json' || $format eq 'json:pretty'){my%opts=(allow_nonref=>1,canonical=>1);$opts{pretty}=1 if$format eq 'json:pretty';print JSON::MaybeXS->new(%opts)->encode($data)}elsif ($format eq 'yaml'){eval {require YAML}or die "Missing dependency: YAML\n";print YAML::Dump($data)}elsif ($format eq 'csv' || $format eq 'tsv' || $format eq 'table'){my$sep=$format eq 'tsv' ? "\t" : ',';my$unpacked=$data;$unpacked=$data->{data}if ref$data eq 'HASH' && $data->{data};my@columns;my$rows=[];if (ref$unpacked eq 'HASH'){if (keys %$unpacked==1){my ($val)=values %$unpacked;if (ref$val eq 'ARRAY'){my$first=$val->[0];if ($first && ref$first eq 'HASH'){@columns=sort keys %$first;$rows=[map {[map {_stringify($_)}@{$_}{@columns}]}@$val ]}elsif ($first){@columns=keys %$unpacked;$rows=[map {[map {_stringify($_)}$_]}@$val]}}}}elsif (ref$unpacked eq 'ARRAY'){my$first=$unpacked->[0];if ($first && ref$first eq 'HASH'){@columns=sort keys %$first;$rows=[map {[map {_stringify($_)}@{$_}{@columns}]}@$unpacked ]}elsif ($first){@columns=qw(column);$rows=[map {[map {_stringify($_)}$_]}@$unpacked]}}if (@columns){if ($format eq 'table'){eval {require Text::Table::Any}or die "Missing dependency: Text::Table::Any\n";my$table=Text::Table::Any::table(header_row=>1,rows=>[[@columns],@$rows],backend=>$ENV{PERL_TEXT_TABLE},);print$table}else {eval {require Text::CSV}or die "Missing dependency: Text::CSV\n";my$csv=Text::CSV->new({binary=>1,sep=>$sep,eol=>$/});$csv->print(*STDOUT,[@columns]);for my$row (@$rows){$csv->print(*STDOUT,$row)}}}else {_print_data($data);print STDERR sprintf("Error: Response could not be formatted as %s.\n",uc($format));exit 3}}elsif ($format eq 'string'){if (!ref$data){print$data,"\n"}elsif (ref$data eq 'ARRAY'){print join("\n",@$data)}else {_print_data($data);print STDERR sprintf("Error: Response could not be formatted as %s.\n",$format);exit 3}}elsif ($format eq 'perl'){eval {require Data::Dumper}or die "Missing dependency: Data::Dumper\n";print Data::Dumper::Dumper($data)}else {_print_data($data);print STDERR "Error: Format not supported: $format\n";exit 3}}sub _parse_path {my$path=shift;my@path;my@segments=map {split(/\./,$_)}split(/(\[[^\.\]]+\])\.?/,$path);for my$segment (@segments){if ($segment =~ /\[([^\.\]]+)\]/){$path[-1]{type}='ARRAY' if@path;push@path,{name=>$1,index=>1,}}else {$path[-1]{type}='HASH' if@path;push@path,{name=>$segment,}}}return \@path}sub _expand_vars {my$vars=shift;my$root={};while (my ($key,$value)=each %$vars){my$parsed_path=_parse_path($key);my$curr=$root;for my$segment (@$parsed_path){my$name=$segment->{name};my$type=$segment->{type}|| '';my$next=$type eq 'HASH' ? {}: $type eq 'ARRAY' ? []: $value;if (ref$curr eq 'HASH'){_croak 'Conflicting keys' if$segment->{index};if (defined$curr->{$name}){_croak 'Conflicting keys' if$type ne ref$curr->{$name};$next=$curr->{$name}}else {$curr->{$name}=$next}}elsif (ref$curr eq 'ARRAY'){_croak 'Conflicting keys' if!$segment->{index};if (defined$curr->[$name]){_croak 'Conflicting keys' if$type ne ref$curr->[$name];$next=$curr->[$name]}else {$curr->[$name]=$next}}else {_croak 'Conflicting keys'}$curr=$next}}return$root}sub _pod2usage {eval {require Pod::Usage};if ($@){my$ref=$VERSION eq '999.999' ? 'master' : "v$VERSION";my$exit=(@_==1 && $_[0]=~ /^\d+$/ && $_[0])// (@_ % 2==0 && {@_}->{'-exitval'})// 2;print STDERR <{url}|| $self->url;my$method=delete$options->{method}|| $self->method;$request && ref($request)eq 'HASH' or _croak q{Usage: $http->execute(\%request)};$request->{query}or _croak q{Request must have a query};$url or _croak q{URL must be provided};my$data={%$request};if ($method eq 'GET' || $method eq 'HEAD'){$data->{variables}=$self->json->encode($data->{variables})if$data->{variables};my$params=www_form_urlencode($data);my$sep=$url =~ /^[^#]+\?/ ? '&' : '?';$url =~ s/#/${sep}${params}#/ or $url .= "${sep}${params}"}else {my$encoded_data=$self->json->encode($data);$options->{content}=$encoded_data;$options->{headers}{'content-length'}=length$encoded_data;$options->{headers}{'content-type'}='application/json;charset=UTF-8'}return$self->_handle_response($self->any_ua->request($method,$url,$options))}sub _handle_response {my$self=shift;my ($resp)=@_;if (eval {$resp->isa('Future')}){return$resp->followed_by(sub {my$f=shift;if (my ($exception,$category,@other)=$f->failure){if (ref$exception eq 'HASH'){my$resp=$exception;return Future->done($self->_handle_error($resp))}return Future->done({error=>$exception,response=>undef,details=>{exception_details=>[$category,@other],},})}my$resp=$f->get;return Future->done($self->_handle_success($resp))})}else {return$self->_handle_error($resp)if!$resp->{success};return$self->_handle_success($resp)}}sub _handle_error {my$self=shift;my ($resp)=@_;my$data=eval {$self->json->decode($resp->{content})};my$content=$resp->{content}// 'No content';my$reason=$resp->{reason}// '';my$message="HTTP transport returned $resp->{status} ($reason): $content";chomp$message;return {error=>$message,response=>$data,details=>{http_response=>$resp,},}}sub _handle_success {my$self=shift;my ($resp)=@_;my$data=eval {$self->json->decode($resp->{content})};if (my$exception=$@){return {error=>"HTTP transport failed to decode response: $exception",response=>undef,details=>{http_response=>$resp,},}}return {response=>$data,details=>{http_response=>$resp,},}}sub ua {my$self=shift;$self->{ua}//= do {require HTTP::Tiny;HTTP::Tiny->new(agent=>$ENV{GRAPHQL_CLIENT_HTTP_USER_AGENT}// "perl-graphql-client/$VERSION",)}}sub any_ua {my$self=shift;$self->{any_ua}//= HTTP::AnyUA->new(ua=>$self->ua)}sub url {my$self=shift;$self->{url}}sub method {my$self=shift;$self->{method}// 'POST'}sub json {my$self=shift;$self->{json}//= do {require JSON::MaybeXS;JSON::MaybeXS->new(utf8=>1)}}1; + package GraphQL::Client::http;use 5.010;use warnings;use strict;use HTTP::AnyUA::Util qw(www_form_urlencode);use HTTP::AnyUA;use namespace::clean;our$VERSION='0.604';sub _croak {require Carp;goto&Carp::croak}sub new {my$class=shift;my$self=@_ % 2==0 ? {@_}: $_[0];bless$self,$class}sub execute {my$self=shift;my ($request,$options)=@_;my$url=delete$options->{url}|| $self->url;my$method=delete$options->{method}|| $self->method;$request && ref($request)eq 'HASH' or _croak q{Usage: $http->execute(\%request)};$request->{query}or _croak q{Request must have a query};$url or _croak q{URL must be provided};my$data={%$request};if ($method eq 'GET' || $method eq 'HEAD'){$data->{variables}=$self->json->encode($data->{variables})if$data->{variables};my$params=www_form_urlencode($data);my$sep=$url =~ /^[^#]+\?/ ? '&' : '?';$url =~ s/#/${sep}${params}#/ or $url .= "${sep}${params}"}else {my$encoded_data=$self->json->encode($data);$options->{content}=$encoded_data;$options->{headers}{'content-length'}=length$encoded_data;$options->{headers}{'content-type'}='application/json;charset=UTF-8'}return$self->_handle_response($self->any_ua->request($method,$url,$options))}sub _handle_response {my$self=shift;my ($resp)=@_;if (eval {$resp->isa('Future')}){return$resp->followed_by(sub {my$f=shift;if (my ($exception,$category,@other)=$f->failure){if (ref$exception eq 'HASH'){my$resp=$exception;return Future->done($self->_handle_error($resp))}return Future->done({error=>$exception,response=>undef,details=>{exception_details=>[$category,@other],},})}my$resp=$f->get;return Future->done($self->_handle_success($resp))})}else {return$self->_handle_error($resp)if!$resp->{success};return$self->_handle_success($resp)}}sub _handle_error {my$self=shift;my ($resp)=@_;my$data=eval {$self->json->decode($resp->{content})};my$content=$resp->{content}// 'No content';my$reason=$resp->{reason}// '';my$message="HTTP transport returned $resp->{status} ($reason): $content";chomp$message;return {error=>$message,response=>$data,details=>{http_response=>$resp,},}}sub _handle_success {my$self=shift;my ($resp)=@_;my$data=eval {$self->json->decode($resp->{content})};if (my$exception=$@){return {error=>"HTTP transport failed to decode response: $exception",response=>undef,details=>{http_response=>$resp,},}}return {response=>$data,details=>{http_response=>$resp,},}}sub ua {my$self=shift;$self->{ua}//= do {require HTTP::Tiny;HTTP::Tiny->new(agent=>$ENV{GRAPHQL_CLIENT_HTTP_USER_AGENT}// "perl-graphql-client/$VERSION",)}}sub any_ua {my$self=shift;$self->{any_ua}//= HTTP::AnyUA->new(ua=>$self->ua)}sub url {my$self=shift;$self->{url}}sub method {my$self=shift;$self->{method}// 'POST'}sub json {my$self=shift;$self->{json}//= do {require JSON::MaybeXS;JSON::MaybeXS->new(utf8=>1)}}1; GRAPHQL_CLIENT_HTTP $fatpacked{"GraphQL/Client/https.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'GRAPHQL_CLIENT_HTTPS'; - package GraphQL::Client::https;use warnings;use strict;use parent 'GraphQL::Client::http';our$VERSION='0.603';sub new {my$class=shift;GraphQL::Client::http->new(@_)}1; + package GraphQL::Client::https;use warnings;use strict;use parent 'GraphQL::Client::http';our$VERSION='0.604';sub new {my$class=shift;GraphQL::Client::http->new(@_)}1; GRAPHQL_CLIENT_HTTPS $fatpacked{"HTTP/AnyUA.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'HTTP_ANYUA'; @@ -174,10 +154,6 @@ $fatpacked{"HTTP/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'HTTP_ HERE HTTP_TINY -$fatpacked{"JSON/MaybeXS.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'JSON_MAYBEXS'; - package JSON::MaybeXS;use strict;use warnings FATAL=>'all';use base qw(Exporter);our$VERSION='1.004000';$VERSION=eval$VERSION;sub _choose_json_module {return 'Cpanel::JSON::XS' if$INC{'Cpanel/JSON/XS.pm'};return 'JSON::XS' if$INC{'JSON/XS.pm'};my@err;return 'Cpanel::JSON::XS' if eval {require Cpanel::JSON::XS;1};push@err,"Error loading Cpanel::JSON::XS: $@";return 'JSON::XS' if eval {require JSON::XS;1};push@err,"Error loading JSON::XS: $@";return 'JSON::PP' if eval {require JSON::PP;1};push@err,"Error loading JSON::PP: $@";die join("\n","Couldn't load a JSON module:",@err)}BEGIN {our$JSON_Class=_choose_json_module();$JSON_Class->import(qw(encode_json decode_json));no strict 'refs';*$_=$JSON_Class->can($_)for qw(true false)}our@EXPORT=qw(encode_json decode_json JSON);my@EXPORT_ALL=qw(is_bool);our@EXPORT_OK=qw(is_bool to_json from_json);our%EXPORT_TAGS=(all=>[@EXPORT,@EXPORT_ALL ],legacy=>[@EXPORT,@EXPORT_OK ],);sub JSON () {our$JSON_Class}sub new {shift;my%args=@_==1 ? %{$_[0]}: @_;my$new=(our$JSON_Class)->new;$new->$_($args{$_})for keys%args;return$new}use Scalar::Util ();sub is_bool {die 'is_bool is not a method' if $_[1];Scalar::Util::blessed($_[0])and ($_[0]->isa('JSON::XS::Boolean')or $_[0]->isa('Cpanel::JSON::XS::Boolean')or $_[0]->isa('JSON::PP::Boolean'))}use Carp ();sub from_json ($@) {if (ref($_[0])=~ /^JSON/ or $_[0]=~ /^JSON/){Carp::croak "from_json should not be called as a method."}my$json=JSON()->new;if (@_==2 and ref $_[1]eq 'HASH'){my$opt=$_[1];for my$method (keys %$opt){$json->$method($opt->{$method})}}return$json->decode($_[0])}sub to_json ($@) {if (ref($_[0])=~ /^JSON/ or (@_ > 2 and $_[0]=~ /^JSON/)){Carp::croak "to_json should not be called as a method."}my$json=JSON()->new;if (@_==2 and ref $_[1]eq 'HASH'){my$opt=$_[1];for my$method (keys %$opt){$json->$method($opt->{$method})}}$json->encode($_[0])}1; -JSON_MAYBEXS - $fatpacked{"JSON/PP.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'JSON_PP'; package JSON::PP;use 5.005;use strict;use Exporter ();BEGIN {@JSON::PP::ISA=('Exporter')}use overload ();use JSON::PP::Boolean;use Carp ();$JSON::PP::VERSION='4.04';@JSON::PP::EXPORT=qw(encode_json decode_json from_json to_json);use constant P_ASCII=>0;use constant P_LATIN1=>1;use constant P_UTF8=>2;use constant P_INDENT=>3;use constant P_CANONICAL=>4;use constant P_SPACE_BEFORE=>5;use constant P_SPACE_AFTER=>6;use constant P_ALLOW_NONREF=>7;use constant P_SHRINK=>8;use constant P_ALLOW_BLESSED=>9;use constant P_CONVERT_BLESSED=>10;use constant P_RELAXED=>11;use constant P_LOOSE=>12;use constant P_ALLOW_BIGNUM=>13;use constant P_ALLOW_BAREKEY=>14;use constant P_ALLOW_SINGLEQUOTE=>15;use constant P_ESCAPE_SLASH=>16;use constant P_AS_NONBLESSED=>17;use constant P_ALLOW_UNKNOWN=>18;use constant P_ALLOW_TAGS=>19;use constant OLD_PERL=>$] < 5.008 ? 1 : 0;use constant USE_B=>$ENV{PERL_JSON_PP_USE_B}|| 0;BEGIN {if (USE_B){require B}}BEGIN {my@xs_compati_bit_properties=qw(latin1 ascii utf8 indent canonical space_before space_after allow_nonref shrink allow_blessed convert_blessed relaxed allow_unknown allow_tags);my@pp_bit_properties=qw(allow_singlequote allow_bignum loose allow_barekey escape_slash as_nonblessed);if (OLD_PERL){my$helper=$] >= 5.006 ? 'JSON::PP::Compat5006' : 'JSON::PP::Compat5005';eval qq| require $helper |;if ($@){Carp::croak $@}}for my$name (@xs_compati_bit_properties,@pp_bit_properties){my$property_id='P_' .uc($name);eval qq/ sub $name { @@ -230,14 +206,26 @@ $fatpacked{"JSON/PP/Boolean.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<< package JSON::PP::Boolean;use strict;require overload;local $^W;overload::import('overload',"0+"=>sub {${$_[0]}},"++"=>sub {$_[0]=${$_[0]}+ 1},"--"=>sub {$_[0]=${$_[0]}- 1},fallback=>1,);$JSON::PP::Boolean::VERSION='4.04';1; JSON_PP_BOOLEAN +$fatpacked{"LV.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'LV'; + use 5.006;use strict;use warnings;package LV;our$AUTHORITY='cpan:TOBYINK';our$VERSION='0.006';BEGIN {*_subname=eval {require Sub::Name}? \&Sub::Name::subname : sub {$_[1]}};use Exporter ();our@ISA=qw(Exporter);our@EXPORT=qw(lvalue);our@EXPORT_OK=qw(get set);sub get (&;@) {my$caller=(caller(1))[3];get=>_subname("$caller~get",shift),@_}sub set (&;@) {my$caller=(caller(1))[3];set=>_subname("$caller~set",shift),@_}{my$i;sub implementation {return$i}sub _set_implementation {my$module=shift;*lvalue=$module->can('lvalue')or do {require Carp;Carp::croak("$module does not appear to be an LV backend")};$i=$module}}if ($ENV{PERL_LV_IMPLEMENTATION}){my$module=sprintf('LV::Backend::%s',$ENV{PERL_LV_IMPLEMENTATION});eval "require $module; 1" or do {require Carp;Carp::croak("Could not load LV backend $module")};_set_implementation($module)}else {my@implementations=qw(LV::Backend::Sentinel LV::Backend::Magic LV::Backend::Tie);for my$module (@implementations){if (eval "require $module; 1"){_set_implementation($module);last}}}unless (__PACKAGE__->can('lvalue')){require Carp;Carp::croak("No suitable backend found for lv")}1; +LV + +$fatpacked{"LV/Backend/Magic.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'LV_BACKEND_MAGIC'; + use 5.008;use strict;use warnings;package LV::Backend::Magic;our$AUTHORITY='cpan:TOBYINK';our$VERSION='0.006';use Carp;use Variable::Magic qw(wizard cast);my$wiz=wizard(data=>sub {$_[1]},set=>sub {$_[1]{set}->(${$_[0]});0},get=>sub {${$_[1]{var}}=$_[1]{get}->();0},);sub lvalue :lvalue {my%args=@_;unless ($args{set}&& $args{get}){my$caller=(caller(1))[3];$args{get}||= sub {require Carp;Carp::croak("$caller is writeonly")};$args{set}||= sub {require Carp;Carp::croak("$caller is readonly")}}$args{var}=\(my$var);cast($var,$wiz,\%args);$var}1; +LV_BACKEND_MAGIC + +$fatpacked{"LV/Backend/Sentinel.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'LV_BACKEND_SENTINEL'; + use 5.008;use strict;use warnings;package LV::Backend::Sentinel;our$AUTHORITY='cpan:TOBYINK';our$VERSION='0.006';use Sentinel;sub lvalue :lvalue {my%args=@_;unless ($args{set}&& $args{get}){my$caller=(caller(1))[3];$args{get}||= sub {require Carp;Carp::croak("$caller is writeonly")};$args{set}||= sub {require Carp;Carp::croak("$caller is readonly")}}sentinel(%args)}1; +LV_BACKEND_SENTINEL + +$fatpacked{"LV/Backend/Tie.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'LV_BACKEND_TIE'; + use 5.006;use strict;use warnings;package LV::Backend::Tie;our$AUTHORITY='cpan:TOBYINK';our$VERSION='0.006';sub lvalue :lvalue {my%args=@_;tie(my$var,'LV::Backend::Tie::TiedScalar',$args{get},$args{set});$var}package LV::Backend::Tie::TiedScalar;our$AUTHORITY='cpan:TOBYINK';our$VERSION='0.006';our@CARP_NOT=qw(LV LV::Backend::Tie);sub TIESCALAR {my$class=shift;my ($get,$set)=@_;unless ($set && $get){my$caller=(caller(2))[3];$get ||= sub {require Carp;Carp::croak("$caller is writeonly")};$set ||= sub {require Carp;Carp::croak("$caller is readonly")}}bless [$get,$set]=>$class}sub FETCH {&{shift->[0]}}sub STORE {&{shift->[1]}}1; +LV_BACKEND_TIE + $fatpacked{"Module/Implementation.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'MODULE_IMPLEMENTATION'; package Module::Implementation;$Module::Implementation::VERSION='0.09';use strict;use warnings;use Module::Runtime 0.012 qw(require_module);use Try::Tiny;unless (exists$Module::Implementation::{VERSION}&& ${$Module::Implementation::{VERSION}}){$Module::Implementation::{VERSION}=\42}my%Implementation;sub build_loader_sub {my$caller=caller();return _build_loader($caller,@_)}sub _build_loader {my$package=shift;my%args=@_;my@implementations=@{$args{implementations}};my@symbols=@{$args{symbols}|| []};my$implementation;my$env_var=uc$package;$env_var =~ s/::/_/g;$env_var .= '_IMPLEMENTATION';return sub {my ($implementation,$loaded)=_load_implementation($package,$ENV{$env_var},\@implementations,);$Implementation{$package}=$implementation;_copy_symbols($loaded,$package,\@symbols);return$loaded}}sub implementation_for {my$package=shift;return$Implementation{$package}}sub _load_implementation {my$package=shift;my$env_value=shift;my$implementations=shift;if ($env_value){die "$env_value is not a valid implementation for $package" unless grep {$_ eq $env_value}@{$implementations};my$requested="${package}::$env_value";($requested)=$requested =~ /^(.+)$/;try {require_module($requested)}catch {require Carp;Carp::croak("Could not load $requested: $_")};return ($env_value,$requested)}else {my$err;for my$possible (@{$implementations}){my$try="${package}::$possible";my$ok;try {require_module($try);$ok=1}catch {$err .= $_ if defined $_};return ($possible,$try)if$ok}require Carp;if (defined$err && length$err){Carp::croak("Could not find a suitable $package implementation: $err")}else {Carp::croak('Module::Runtime failed to load a module but did not throw a real error. This should never happen. Something is very broken')}}}sub _copy_symbols {my$from_package=shift;my$to_package=shift;my$symbols=shift;for my$sym (@{$symbols}){my$type=$sym =~ s/^([\$\@\%\&\*])// ? $1 : '&';my$from="${from_package}::$sym";my$to="${to_package}::$sym";{no strict 'refs';no warnings 'once';*{$to}=$type eq '&' ? \&{$from}: $type eq '$' ? \${$from}: $type eq '@' ? \@{$from}: $type eq '%' ? \%{$from}: $type eq '*' ? *{$from}: die "Can't copy symbol from $from_package to $to_package: $type$sym"}}}1; MODULE_IMPLEMENTATION -$fatpacked{"Module/Loader.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'MODULE_LOADER'; - package Module::Loader;$Module::Loader::VERSION='0.03';use 5.006;use strict;use warnings;use Path::Iterator::Rule;use File::Spec::Functions qw/catfile splitdir/;use Carp qw/croak/;sub new {my ($class,%attributes)=@_;bless {%attributes},$class}sub max_depth {my$self=shift;croak 'max_depth is immutable' if @_ > 0;return$self->{max_depth}if exists($self->{max_depth});return}sub find_modules {my$self=shift;my$base=shift;my$argref=@_ > 0 ? shift : {};my$max_depth=$argref->{max_depth}|| $self->{max_depth}|| 0;my@baseparts=split(/::/,$base);my%modules;for my$directory (@INC){my$path=catfile($directory,@baseparts);next unless -d $path;my$rule=Path::Iterator::Rule->new->perl_module;$rule->max_depth($max_depth)if$max_depth;for my$file ($rule->all($path)){(my$modpath=$file)=~ s!^\Q$directory\E.|\.pm$!!g;my$module=join('::',splitdir($modpath));$modules{$module }++}}return keys(%modules)}sub search {my ($self,$base)=@_;return$self->find_modules($base,{max_depth=>1 })}sub load {my ($self,@modules)=@_;require Module::Runtime;for my$module (@modules){Module::Runtime::require_module($module)}}1; -MODULE_LOADER - $fatpacked{"Module/Runtime.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'MODULE_RUNTIME'; package Module::Runtime;BEGIN {require 5.006}BEGIN {${^WARNING_BITS}=""}our$VERSION="0.016";our@EXPORT_OK=qw($module_name_rx is_module_name is_valid_module_name check_module_name module_notional_filename require_module use_module use_package_optimistically $top_module_spec_rx $sub_module_spec_rx is_module_spec is_valid_module_spec check_module_spec compose_module_name);my%export_ok=map {($_=>undef)}@EXPORT_OK;sub import {my$me=shift;my$callpkg=caller(0);my$errs="";for(@_){if(exists$export_ok{$_}){if(/\A\$(.*)\z/s){*{$callpkg."::".$1}=\$$1}else {*{$callpkg."::".$_}=\&$_}}else {$errs .= "\"$_\" is not exported by the $me module\n"}}if($errs ne ""){die "${errs}Can't continue after import errors "."at @{[(caller(0))[1]]} line @{[(caller(0))[2]]}.\n"}}sub _is_string($) {my($arg)=@_;return defined($arg)&& ref(\$arg)eq "SCALAR"}our$module_name_rx=qr/[A-Z_a-z][0-9A-Z_a-z]*(?:::[0-9A-Z_a-z]+)*/;my$qual_module_spec_rx=qr#(?:/|::)[A-Z_a-z][0-9A-Z_a-z]*(?:(?:/|::)[0-9A-Z_a-z]+)*#;my$unqual_top_module_spec_rx=qr#[A-Z_a-z][0-9A-Z_a-z]*(?:(?:/|::)[0-9A-Z_a-z]+)*#;our$top_module_spec_rx=qr/$qual_module_spec_rx|$unqual_top_module_spec_rx/o;my$unqual_sub_module_spec_rx=qr#[0-9A-Z_a-z]+(?:(?:/|::)[0-9A-Z_a-z]+)*#;our$sub_module_spec_rx=qr/$qual_module_spec_rx|$unqual_sub_module_spec_rx/o;sub is_module_name($) {_is_string($_[0])&& $_[0]=~ /\A$module_name_rx\z/o}*is_valid_module_name=\&is_module_name;sub check_module_name($) {unless(&is_module_name){die +(_is_string($_[0])? "`$_[0]'" : "argument")." is not a module name\n"}}sub module_notional_filename($) {&check_module_name;my($name)=@_;$name =~ s!::!/!g;return$name.".pm"}BEGIN {*_WORK_AROUND_HINT_LEAKAGE="$]" < 5.011 &&!("$]" >= 5.009004 && "$]" < 5.010001)? sub(){1}: sub(){0};*_WORK_AROUND_BROKEN_MODULE_STATE="$]" < 5.009 ? sub(){1}: sub(){0}}BEGIN {if(_WORK_AROUND_BROKEN_MODULE_STATE){eval q{ sub Module::Runtime::__GUARD__::DESTROY { @@ -256,31 +244,65 @@ $fatpacked{"Number/Compare.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<' $}ix or croak "don't understand '$test' as a test";my$comparison=$1 || '==';my$target=$2;my$magnitude=$3 || '';$target *= 1000 if lc$magnitude eq 'k';$target *= 1024 if lc$magnitude eq 'ki';$target *= 1000000 if lc$magnitude eq 'm';$target *= 1024*1024 if lc$magnitude eq 'mi';$target *= 1000000000 if lc$magnitude eq 'g';$target *= 1024*1024*1024 if lc$magnitude eq 'gi';return "$comparison $target"}sub test {$_[0]->($_[1])}1; NUMBER_COMPARE -$fatpacked{"PIR.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PIR'; - use 5.008001;use strict;use warnings;package PIR;our$VERSION='1.014';use Path::Iterator::Rule;our@ISA=qw/Path::Iterator::Rule/;1; -PIR - -$fatpacked{"Package/Stash.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PACKAGE_STASH'; - package Package::Stash;use strict;use warnings;use 5.008001;our$VERSION='0.38';our$IMPLEMENTATION;use Module::Implementation 0.06;BEGIN {local$ENV{PACKAGE_STASH_IMPLEMENTATION}=$IMPLEMENTATION if ($IMPLEMENTATION and not $ENV{PACKAGE_STASH_IMPLEMENTATION});Module::Implementation::build_loader_sub(implementations=>['XS','PP' ],symbols=>[qw(new name namespace add_symbol remove_glob has_symbol get_symbol get_or_add_symbol remove_symbol list_all_symbols get_all_symbols)],)->();$IMPLEMENTATION=Module::Implementation::implementation_for(__PACKAGE__)}1; -PACKAGE_STASH - -$fatpacked{"Package/Stash/Conflicts.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PACKAGE_STASH_CONFLICTS'; - package Package::Stash::Conflicts;use strict;use warnings;use Dist::CheckConflicts -dist=>'Package::Stash',-conflicts=>{'Class::MOP'=>'1.08','MooseX::Method::Signatures'=>'0.36','MooseX::Role::WithOverloading'=>'0.08','namespace::clean'=>'0.18',},-also=>[qw(B Carp Dist::CheckConflicts Getopt::Long Module::Implementation Scalar::Util Symbol constant strict warnings) ],;1; -PACKAGE_STASH_CONFLICTS - -$fatpacked{"Package/Stash/PP.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PACKAGE_STASH_PP'; - package Package::Stash::PP;use strict;use warnings;our$VERSION='0.38';use B;use Carp qw(confess);use Scalar::Util qw(blessed reftype weaken);use Symbol;use constant BROKEN_ISA_ASSIGNMENT=>($] < 5.012);use constant BROKEN_WEAK_STASH=>($] < 5.010);use constant BROKEN_SCALAR_INITIALIZATION=>($] < 5.010);use constant BROKEN_GLOB_ASSIGNMENT=>($] < 5.013004);use constant HAS_ISA_CACHE=>($] < 5.010);sub new {my$class=shift;my ($package)=@_;if (!defined($package)|| (ref($package)&& reftype($package)ne 'HASH')){confess "Package::Stash->new must be passed the name of the " ."package to access"}elsif (ref($package)&& reftype($package)eq 'HASH'){confess "The PP implementation of Package::Stash does not support " ."anonymous stashes before perl 5.14" if BROKEN_GLOB_ASSIGNMENT;return bless {'namespace'=>$package,},$class}elsif ($package =~ /\A[0-9A-Z_a-z]+(?:::[0-9A-Z_a-z]+)*\z/){return bless {'package'=>$package,},$class}else {confess "$package is not a module name"}}sub name {confess "Can't call name as a class method" unless blessed($_[0]);confess "Can't get the name of an anonymous package" unless defined($_[0]->{package});return $_[0]->{package}}sub namespace {confess "Can't call namespace as a class method" unless blessed($_[0]);if (BROKEN_WEAK_STASH){no strict 'refs';return \%{$_[0]->name .'::'}}else {return $_[0]->{namespace}if defined $_[0]->{namespace};{no strict 'refs';$_[0]->{namespace}=\%{$_[0]->name .'::'}}weaken($_[0]->{namespace});return $_[0]->{namespace}}}{my%SIGIL_MAP=('$'=>'SCALAR','@'=>'ARRAY','%'=>'HASH','&'=>'CODE',''=>'IO',);sub _deconstruct_variable_name {my ($variable)=@_;my@ret;if (ref($variable)eq 'HASH'){@ret=@{$variable}{qw[name sigil type]}}else {(defined$variable && length$variable)|| confess "You must pass a variable name";my$sigil=substr($variable,0,1,'');if (exists$SIGIL_MAP{$sigil}){@ret=($variable,$sigil,$SIGIL_MAP{$sigil})}else {@ret=("${sigil}${variable}",'',$SIGIL_MAP{''})}}($ret[0]!~ /::/)|| confess "Variable names may not contain ::";return@ret}}sub _valid_for_type {my ($value,$type)=@_;if ($type eq 'HASH' || $type eq 'ARRAY' || $type eq 'IO' || $type eq 'CODE'){return reftype($value)eq $type}else {my$ref=reftype($value);return!defined($ref)|| $ref eq 'SCALAR' || $ref eq 'REF' || $ref eq 'LVALUE' || $ref eq 'REGEXP' || $ref eq 'VSTRING'}}sub add_symbol {my ($self,$variable,$initial_value,%opts)=@_;my ($name,$sigil,$type)=_deconstruct_variable_name($variable);if (@_ > 2){_valid_for_type($initial_value,$type)|| confess "$initial_value is not of type $type";if ($^P and $^P & 0x10 && $sigil eq '&'){my$filename=$opts{filename};my$first_line_num=$opts{first_line_num};(undef,$filename,$first_line_num)=caller if not defined$filename;my$last_line_num=$opts{last_line_num}|| ($first_line_num ||= 0);$DB::sub{$self->name .'::' .$name}="$filename:$first_line_num-$last_line_num"}}if (BROKEN_GLOB_ASSIGNMENT){if (@_ > 2){no strict 'refs';no warnings 'redefine';*{$self->name .'::' .$name}=ref$initial_value ? $initial_value : \$initial_value}else {no strict 'refs';if (BROKEN_ISA_ASSIGNMENT && $name eq 'ISA'){*{$self->name .'::' .$name}}else {my$undef=_undef_ref_for_type($type);*{$self->name .'::' .$name}=$undef}}}else {my$namespace=$self->namespace;{local*__ANON__::=$namespace;no strict 'refs';no warnings 'void';no warnings 'once';*{"__ANON__::$name"}}if (@_ > 2){no warnings 'redefine';*{$namespace->{$name}}=ref$initial_value ? $initial_value : \$initial_value}else {return if BROKEN_ISA_ASSIGNMENT && $name eq 'ISA';*{$namespace->{$name}}=_undef_ref_for_type($type)}}}sub _undef_ref_for_type {my ($type)=@_;if ($type eq 'ARRAY'){return []}elsif ($type eq 'HASH'){return {}}elsif ($type eq 'SCALAR'){return \undef}elsif ($type eq 'IO'){return Symbol::geniosym}elsif ($type eq 'CODE'){confess "Don't know how to vivify CODE variables"}else {confess "Unknown type $type in vivication"}}sub remove_glob {my ($self,$name)=@_;delete$self->namespace->{$name}}sub has_symbol {my ($self,$variable)=@_;my ($name,$sigil,$type)=_deconstruct_variable_name($variable);my$namespace=$self->namespace;return unless exists$namespace->{$name};my$entry_ref=\$namespace->{$name};if (reftype($entry_ref)eq 'GLOB'){if ($type eq 'SCALAR'){if (BROKEN_SCALAR_INITIALIZATION){return defined ${*{$entry_ref}{$type}}}else {my$sv=B::svref_2object($entry_ref)->SV;return$sv->isa('B::SV')|| ($sv->isa('B::SPECIAL')&& $B::specialsv_name[$$sv]ne 'Nullsv')}}else {return defined *{$entry_ref}{$type}}}else {return$type eq 'CODE'}}sub get_symbol {my ($self,$variable,%opts)=@_;my ($name,$sigil,$type)=_deconstruct_variable_name($variable);my$namespace=$self->namespace;if (!exists$namespace->{$name}){if ($opts{vivify}){$self->add_symbol($variable)}else {return undef}}my$entry_ref=\$namespace->{$name};if (ref($entry_ref)eq 'GLOB'){return *{$entry_ref}{$type}}else {if ($type eq 'CODE'){if (BROKEN_GLOB_ASSIGNMENT || defined($self->{package})){no strict 'refs';return \&{$self->name .'::' .$name}}if (blessed($namespace)&& $namespace->isa('Package::Anon')){$namespace->bless(\(my$foo))->can($name)}else {confess "Don't know how to inflate a " .ref($entry_ref)." into a full coderef (perhaps you could use" ." Package::Anon instead of a bare stash?)"}return *{$namespace->{$name}}{CODE}}else {return undef}}}sub get_or_add_symbol {my$self=shift;$self->get_symbol(@_,vivify=>1)}sub remove_symbol {my ($self,$variable)=@_;my ($name,$sigil,$type)=_deconstruct_variable_name($variable);my%desc=(SCALAR=>{sigil=>'$',type=>'SCALAR',name=>$name },ARRAY=>{sigil=>'@',type=>'ARRAY',name=>$name },HASH=>{sigil=>'%',type=>'HASH',name=>$name },CODE=>{sigil=>'&',type=>'CODE',name=>$name },IO=>{sigil=>'',type=>'IO',name=>$name },);confess "This should never ever ever happen" if!$desc{$type};my@types_to_store=grep {$type ne $_ && $self->has_symbol($desc{$_})}keys%desc;my%values=map {$_,$self->get_symbol($desc{$_})}@types_to_store;$values{SCALAR}=$self->get_symbol($desc{SCALAR})if!defined$values{SCALAR}&& $type ne 'SCALAR' && BROKEN_SCALAR_INITIALIZATION;$self->remove_glob($name);$self->add_symbol($desc{$_}=>$values{$_})for grep {defined$values{$_}}keys%values}sub list_all_symbols {my ($self,$type_filter)=@_;my$namespace=$self->namespace;if (HAS_ISA_CACHE){return grep {$_ ne '::ISA::CACHE::'}keys %{$namespace}unless defined$type_filter}else {return keys %{$namespace}unless defined$type_filter}if ($type_filter eq 'CODE'){return grep {ref(\$namespace->{$_})ne 'GLOB' || defined(*{$namespace->{$_}}{CODE})}keys %{$namespace}}elsif ($type_filter eq 'SCALAR'){return grep {!(HAS_ISA_CACHE && $_ eq '::ISA::CACHE::')&& (BROKEN_SCALAR_INITIALIZATION ? (ref(\$namespace->{$_})eq 'GLOB' && defined(${*{$namespace->{$_}}{'SCALAR'}})): (do {my$entry=\$namespace->{$_};ref($entry)eq 'GLOB' && B::svref_2object($entry)->SV->isa('B::SV')}))}keys %{$namespace}}else {return grep {ref(\$namespace->{$_})eq 'GLOB' && defined(*{$namespace->{$_}}{$type_filter})}keys %{$namespace}}}sub get_all_symbols {my ($self,$type_filter)=@_;my$namespace=$self->namespace;return {%{$namespace}}unless defined$type_filter;return {map {$_=>$self->get_symbol({name=>$_,type=>$type_filter})}$self->list_all_symbols($type_filter)}}1; -PACKAGE_STASH_PP - -$fatpacked{"Path/Iterator/Rule.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PATH_ITERATOR_RULE'; - use 5.008001;use strict;use warnings;package Path::Iterator::Rule;our$VERSION='1.014';use warnings::register;use if $] ge '5.010000','re','regexp_pattern';use Carp ();use File::Basename ();use File::Spec ();use List::Util ();use Number::Compare 0.02;use Scalar::Util ();use Text::Glob ();use Try::Tiny;sub new {my$class=shift;$class=ref$class if ref$class;return bless {rules=>[]},$class}sub clone {my$self=shift;return bless _my_clone({%$self}),ref$self}sub _my_clone {my$d=shift;if (ref$d eq 'HASH'){return {map {;my$v=$d->{$_};$_=>(ref($v)? _my_clone($v): $v)}keys %$d }}elsif (ref$d eq 'ARRAY'){return [map {ref($_)? _my_clone($_): $_}@$d ]}else {return$d}}sub add_helper {my ($class,$name,$coderef,$skip_negation)=@_;$class=ref$class if ref$class;if (!$class->can($name)){no strict 'refs';*$name=sub {my$self=shift;my$rule=$coderef->(@_);$self->and($rule)};if (!$skip_negation){*{"not_$name"}=sub {my$self=shift;my$rule=$coderef->(@_);$self->not($rule)}}}else {Carp::croak("Can't add rule '$name' because it conflicts with an existing method")}}sub _objectify {my ($self,$path)=@_;return "$path"}sub _defaults {return (_stringify=>1,follow_symlinks=>1,depthfirst=>0,sorted=>1,loop_safe=>($^O eq 'MSWin32' ? 0 : 1),error_handler=>sub {die sprintf("%s: %s",@_)},visitor=>undef,)}sub _fast_defaults {return (_stringify=>1,follow_symlinks=>1,depthfirst=>-1,sorted=>0,loop_safe=>0,error_handler=>undef,visitor=>undef,)}sub iter {my$self=shift;$self->_iter({$self->_defaults },@_)}sub iter_fast {my$self=shift;$self->_iter({$self->_fast_defaults },@_)}sub _iter {my$self=shift;my$defaults=shift;my$args=ref($_[0])&&!Scalar::Util::blessed($_[0])? shift : ref($_[-1])&&!Scalar::Util::blessed($_[-1])? pop : {};my%opts=(%$defaults,%$args);my$opt_stringify=$opts{_stringify};my$opt_depthfirst=$opts{depthfirst};my$opt_follow_symlinks=$opts{follow_symlinks};my$opt_sorted=$opts{sorted};my$opt_loop_safe=$opts{loop_safe};my$opt_error_handler=$opts{error_handler};my$opt_relative=$opts{relative};my$opt_visitor=$opts{visitor};my$has_rules=@{$self->{rules}};my$stash={};my$opt_report_symlinks=defined($opts{report_symlinks})? $opts{report_symlinks}: $opts{follow_symlinks};my$can_children=$self->can("_children");my@queue=map {my$i=$self->_objectify($_);($i,File::Basename::basename("$_"),0,$i)}@_ ? @_ : '.';return sub {LOOP: {my ($item,$base,$depth,$origin)=splice(@queue,0,4);return unless$item;if (ref$item eq 'CODE'){unshift@queue,$item->();redo LOOP}return$item->[0]if ref$item eq 'ARRAY';my$string_item=$opt_stringify ? "$item" : $item;my ($interest,$prune)=(1,0);if (-l $string_item){$prune=1 if!$opt_follow_symlinks;redo LOOP if!$opt_report_symlinks}if ($has_rules){local $_=$item;$stash->{_depth}=$depth;if ($opt_error_handler){$interest=try {$self->test($item,$base,$stash)}catch {$opt_error_handler->($item,$_)}}else {$interest=$self->test($item,$base,$stash)}if (ref$interest eq 'SCALAR'){$prune=1;$interest=$$interest}}if ($opt_visitor && $interest){local $_=$item;$stash->{_depth}=$depth;$opt_visitor->($item,$base,$stash)}if ((-d $string_item)&& (!$prune)&& (!$opt_loop_safe || $self->_is_unique($string_item,$stash))){if (!-r $string_item){warnings::warnif("Directory '$string_item' is not readable. Skipping it")}else {my$depth_p1=$depth + 1;my$next;if ($can_children){$next=sub {my@paths=$can_children->($self,$item);if ($opt_sorted){@paths=sort {"$a->[0]" cmp "$b->[0]"}@paths}map {($_->[1],$_->[0],$depth_p1,$origin)}@paths}}else {$next=sub {opendir(my$dh,$string_item);if ($opt_sorted){map {("$string_item/$_",$_,$depth_p1,$origin)}sort {$a cmp $b}grep {$_ ne "." && $_ ne ".."}readdir$dh}else {map {("$string_item/$_",$_,$depth_p1,$origin)}grep {$_ ne "." && $_ ne ".."}readdir$dh}}}if ($opt_depthfirst){unshift@queue,[($opt_relative ? $self->_objectify(File::Spec->abs2rel($string_item,$origin)): $item)],undef,undef,undef if$interest && $opt_depthfirst > 0;unshift@queue,$next,undef,undef,undef;redo LOOP if$opt_depthfirst > 0}else {push@queue,$next,undef,undef,undef}}}return ($opt_relative ? $self->_objectify(File::Spec->abs2rel($string_item,$origin)): $item)if$interest;redo LOOP}}}sub all {my$self=shift;return$self->_all($self->iter(@_))}sub all_fast {my$self=shift;return$self->_all($self->iter_fast(@_))}sub _all {my$self=shift;my$iter=shift;if (wantarray){my@results;while (defined(my$item=$iter->())){push@results,$item}return@results}elsif (defined wantarray){my$count=0;$count++ while defined$iter->();return$count}else {1 while defined$iter->()}}sub and {my$self=shift;push @{$self->{rules}},$self->_rulify(@_);return$self}sub or {my$self=shift;my@rules=$self->_rulify(@_);my$coderef=sub {my ($result,$prune);for my$rule (@rules){$result=$rule->(@_);$prune ||= ref($result)eq 'SCALAR';$result=$$result if ref($result)eq 'SCALAR';return ($prune ? \1 : 1)if$result}return ($prune ? \$result : $result)};return$self->and($coderef)}sub not {my$self=shift;my$obj=$self->new->and(@_);my$coderef=sub {my$result=$obj->test(@_);return ref($result)? \!$$result :!$result};return$self->and($coderef)}sub skip {my$self=shift;my@rules=@_;my$obj=$self->new->or(@rules);my$coderef=sub {my$result=$obj->test(@_);my ($prune,$interest);if (ref($result)eq 'SCALAR'){$prune=1;$interest=0}else {$prune=$result;$interest=!$result}return$prune ? \$interest : $interest};return$self->and($coderef)}sub test {my ($self,$item,$base,$stash)=@_;my ($result,$prune);for my$rule (@{$self->{rules}}){$result=$rule->($item,$base,$stash)|| 0;if (!ref($result)&& $result eq '0 but true'){Carp::croak("0 but true no longer supported by custom rules")}$prune ||= ref($result)eq 'SCALAR';$result=$$result if ref($result)eq 'SCALAR';return ($prune ? \0 : 0)if!$result}return ($prune ? \1 : 1)}sub _rulify {my ($self,@args)=@_;my@rules;for my$arg (@args){my$rule;if (Scalar::Util::blessed($arg)&& $arg->isa("Path::Iterator::Rule")){$rule=sub {$arg->test(@_)}}elsif (ref($arg)eq 'CODE'){$rule=$arg}else {Carp::croak("Rules must be coderef or Path::Iterator::Rule")}push@rules,$rule}return@rules}sub _is_unique {my ($self,$string_item,$stash)=@_;my$unique_id;my@st=eval {stat$string_item};@st=eval {lstat$string_item}unless@st;if (@st){$unique_id=join(",",$st[0],$st[1])}else {my$type=-d $string_item ? 'directory' : 'file';warnings::warnif("Could not stat $type '$string_item'");$unique_id=$string_item}return!$stash->{_seen}{$unique_id}++}sub _regexify {my ($re,$add)=@_;$add ||= '';my$new=ref($re)eq 'Regexp' ? $re : Text::Glob::glob_to_regex($re);return$new unless$add;my ($pattern,$flags)=_split_re($new);my$new_flags=$add ? _reflag($flags,$add): "";return qr/$new_flags$pattern/}sub _split_re {my$value=shift;if ($] ge 5.010){return re::regexp_pattern($value)}else {$value =~ s/^\(\?\^?//;$value =~ s/\)$//;my ($opt,$re)=split(/:/,$value,2);$opt =~ s/\-\w+$//;return ($re,$opt)}}sub _reflag {my ($orig,$add)=@_;$orig ||= "";if ($] >= 5.014){return "(?^$orig$add)"}else {my ($pos,$neg)=split /-/,$orig;$pos ||= "";$neg ||= "";$neg =~ s/i//;$neg="-$neg" if length$neg;return "(?$add$pos$neg)"}}my%simple_helpers=(directory=>sub {-d $_},dangling=>sub {-l $_ &&!stat $_},);while (my ($k,$v)=each%simple_helpers){__PACKAGE__->add_helper($k,sub {return$v})}sub _generate_name_matcher {my (@patterns)=@_;if (@patterns > 1){return sub {my$name="$_[1]";return (List::Util::first {$name =~ $_}@patterns)? 1 : 0}}else {my$pattern=$patterns[0];return sub {my$name="$_[1]";return$name =~ $pattern ? 1 : 0}}}my%complex_helpers=(name=>sub {Carp::croak("No patterns provided to 'name'")unless @_;_generate_name_matcher(map {_regexify($_)}@_)},iname=>sub {Carp::croak("No patterns provided to 'iname'")unless @_;_generate_name_matcher(map {_regexify($_,"i")}@_)},min_depth=>sub {Carp::croak("No depth argument given to 'min_depth'")unless @_;my$min_depth=0+ shift;return sub {my ($f,$b,$stash)=@_;return$stash->{_depth}>= $min_depth}},max_depth=>sub {Carp::croak("No depth argument given to 'max_depth'")unless @_;my$max_depth=0+ shift;return sub {my ($f,$b,$stash)=@_;return 1 if$stash->{_depth}< $max_depth;return \1 if$stash->{_depth}==$max_depth;return \0}},shebang=>sub {Carp::croak("No patterns provided to 'shebang'")unless @_;my@patterns=map {_regexify($_)}@_;return sub {my$f=shift;return unless!-d $f;open my$fh,"<",$f;my$shebang=<$fh>;return unless defined$shebang;return (List::Util::first {$shebang =~ $_}@patterns)? 1 : 0}},contents_match=>sub {my@regexp=@_;my$filter=':encoding(UTF-8)';$filter=shift@regexp unless ref$regexp[0];return sub {my$f=shift;return unless!-d $f;my$contents=do {local $/=undef;open my$fh,"<$filter",$f;<$fh>};for my$re (@regexp){return 1 if$contents =~ $re}return 0}},line_match=>sub {my@regexp=@_;my$filter=':encoding(UTF-8)';$filter=shift@regexp unless ref$regexp[0];return sub {my$f=shift;return unless!-d $f;open my$fh,"<$filter",$f;while (my$line=<$fh>){for my$re (@regexp){return 1 if$line =~ $re}}return 0}},);while (my ($k,$v)=each%complex_helpers){__PACKAGE__->add_helper($k,$v)}__PACKAGE__->add_helper(skip_dirs=>sub {Carp::croak("No patterns provided to 'skip_dirs'")unless @_;my$name_check=Path::Iterator::Rule->new->name(@_);return sub {return \0 if -d $_[0]&& $name_check->test(@_);return 1}}=>1);__PACKAGE__->add_helper(skip_subdirs=>sub {Carp::croak("No patterns provided to 'skip_subdirs'")unless @_;my$name_check=Path::Iterator::Rule->new->name(@_);return sub {my ($f,$b,$stash)=@_;return \0 if -d $f && $stash->{_depth}&& $name_check->test(@_);return 1}}=>1);my%X_tests=(-r=>readable=>-R=>r_readable=>-w=>writeable=>-W=>r_writeable=>-w=>writable=>-W=>r_writable=>-x=>executable=>-X=>r_executable=>-o=>owned=>-O=>r_owned=>-e=>exists=>-f=>file=>-z=>empty=>-d=>dir=>-s=>nonempty=>-l=>symlink=>=>-p=>fifo=>-u=>setuid=>-S=>socket=>-g=>setgid=>-b=>block=>-k=>sticky=>-c=>character=>=>-t=>tty=>-T=>ascii=>-B=>binary=>);while (my ($op,$name)=each%X_tests){my$coderef=eval "sub { $op \$_ }";__PACKAGE__->add_helper($name,sub {return$coderef})}my%time_tests=(-A=>accessed=>-M=>modified=>-C=>changed=>);while (my ($op,$name)=each%time_tests){my$filetest=eval "sub { $op \$_ }";my$coderef=sub {Carp::croak("The '$name' test requires a single argument")unless @_==1;my$comparator=Number::Compare->new(shift);return sub {return$comparator->($filetest->())}};__PACKAGE__->add_helper($name,$coderef)}my@stat_tests=qw(dev ino mode nlink uid gid rdev size atime mtime ctime blksize blocks);for my$i (0 .. $#stat_tests){my$name=$stat_tests[$i];my$coderef=sub {Carp::croak("The '$name' test requires a single argument")unless @_==1;my$comparator=Number::Compare->new(shift);return sub {return$comparator->((stat($_))[$i])}};__PACKAGE__->add_helper($name,$coderef)}my%vcs_rules=(skip_cvs=>sub {return Path::Iterator::Rule->new->skip_dirs('CVS')->not_name(qr/\.\#$/)},skip_rcs=>sub {return Path::Iterator::Rule->new->skip_dirs('RCS')->not_name(qr/,v$/)},skip_git=>sub {return Path::Iterator::Rule->new->skip_dirs('.git')},skip_svn=>sub {return Path::Iterator::Rule->new->skip_dirs(($^O eq 'MSWin32')? ('.svn','_svn'): ('.svn'))},skip_bzr=>sub {return Path::Iterator::Rule->new->skip_dirs('.bzr')},skip_hg=>sub {return Path::Iterator::Rule->new->skip_dirs('.hg')},skip_darcs=>sub {return Path::Iterator::Rule->new->skip_dirs('_darcs')},skip_vcs=>sub {return Path::Iterator::Rule->new->skip_dirs(qw/.git .bzr .hg _darcs CVS RCS/)->skip_svn->not_name(qr/\.\#$/,qr/,v$/)},);while (my ($name,$coderef)=each%vcs_rules){__PACKAGE__->add_helper($name,$coderef,1)}my%perl_rules=(perl_module=>sub {return Path::Iterator::Rule->new->file->name('*.pm')},perl_pod=>sub {return Path::Iterator::Rule->new->file->name('*.pod')},perl_test=>sub {return Path::Iterator::Rule->new->file->name('*.t')},perl_installer=>sub {return Path::Iterator::Rule->new->file->name('Makefile.PL','Build.PL')},perl_script=>sub {return Path::Iterator::Rule->new->file->or(Path::Iterator::Rule->new->name('*.pl'),Path::Iterator::Rule->new->shebang(qr/#!.*\bperl\b/),)},perl_file=>sub {return Path::Iterator::Rule->new->or(Path::Iterator::Rule->new->perl_module,Path::Iterator::Rule->new->perl_pod,Path::Iterator::Rule->new->perl_test,Path::Iterator::Rule->new->perl_installer,Path::Iterator::Rule->new->perl_script,)},);while (my ($name,$coderef)=each%perl_rules){__PACKAGE__->add_helper($name,$coderef)}1; -PATH_ITERATOR_RULE - $fatpacked{"Proc/Find/Parents.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PROC_FIND_PARENTS'; package Proc::Find::Parents;our$DATE='2018-01-17';our$VERSION='0.631';use 5.010001;use strict;use warnings;require Exporter;our@ISA=qw(Exporter);our@EXPORT_OK=qw(get_parent_processes);sub get_parent_processes {my ($pid,$opts)=@_;$pid //= $$;$opts //= {};my%proc;if (($opts->{method}// 'proctable')eq 'pstree'){my@lines=`pstree -pAl`;return undef unless@lines;my@p;for (@lines){my$i=0;while (/(?: (\s*(?:\|-?|`-)) | (.+?)\((\d+)\) ) (?: -[+-]- )?/gx){unless ($1){my$p={name=>$2,pid=>$3};$p[$i]=$p;$p->{ppid}=$p[$i-1]{pid}if$i > 0;$proc{$3}=$p}$i++}}}else {eval {require Proc::ProcessTable};return undef if $@;state$pt=Proc::ProcessTable->new;for my$p (@{$pt->table}){$proc{$p->{pid}}={name=>$p->{fname},cmdline=>$p->{cmndline},pid=>$p->{pid},ppid=>$p->{ppid},uid=>$p->{uid},gid=>$p->{gid},pgrp=>$p->{pgrp},sess=>$p->{sess},sgid=>$p->{sgid},euid=>$p->{euid},egid=>$p->{egid},ttydev=>$p->{ttydev},ttynum=>$p->{ttynum},}}}my@p=();my$cur_pid=$pid;while (1){return if!$proc{$cur_pid};$proc{$cur_pid}{name}=$1 if$proc{$cur_pid}{name}=~ /\A\{(.+)\}\z/;push@p,$proc{$cur_pid};$cur_pid=$proc{$cur_pid}{ppid};last unless$cur_pid}shift@p;\@p}1; PROC_FIND_PARENTS +$fatpacked{"Readonly.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'READONLY'; + package Readonly;use 5.005;use strict;package Readonly;our$VERSION='2.05';$VERSION=eval$VERSION;sub croak {require Carp;goto&Carp::croak}use vars qw/$XSokay/;sub _ARRAY (\@);sub _HASH (\%);if ($] < 5.008){*is_sv_readonly=sub ($) {0};*make_sv_readonly =sub ($) {die "make_sv_readonly called but not overridden"};$Readonly::XS::MAGIC_COOKIE=$Readonly::XS::MAGIC_COOKIE ="Do NOT use or require Readonly::XS unless you're me.";eval 'use Readonly::XS'}else {*is_sv_readonly=sub ($) {Internals::SvREADONLY($_[0])};*make_sv_readonly =sub ($) {Internals::SvREADONLY($_[0],1)};$XSokay=1}sub _SCALAR ($) {my ($r_var)=@_;if ($XSokay){Internals::SvREADONLY($r_var,0)if is_sv_readonly($r_var)}else {return if tied($r_var)!~ 'Readonly::Scalar';my$r_scalar;{my$obj=tied $$r_var;$r_scalar=$obj}untie$r_var;$r_var=$r_scalar}}sub _ARRAY (\@) {my ($r_var)=@_;return if!tied(@$r_var);return if tied(@$r_var)!~ 'Readonly::Array';my$r_array;{my$obj=tied @$r_var;$r_array=$obj}untie @$r_var;@$r_var=@$r_array;for (@$r_var){my$_reftype=ref $_;if ($_reftype eq 'SCALAR'){_SCALAR($_)}elsif ($_reftype eq 'ARRAY'){_ARRAY(@$_)}elsif ($_reftype eq 'HASH'){_HASH(%$_)}}}sub _HASH (\%) {my ($r_var)=@_;return if!tied(%$r_var);return if tied(%$r_var)!~ 'Readonly::Hash';my$r_hash;{my$obj=tied %$r_var;$r_hash=$obj}untie %$r_var;%$r_var=%$r_hash;for (values %$r_var){my$_reftype=ref $_;if ($_reftype eq 'SCALAR'){_SCALAR($_)}elsif ($_reftype eq 'ARRAY'){_ARRAY(@$_)}elsif ($_reftype eq 'HASH'){_HASH(%$_)}}}use vars qw/$MODIFY $REASSIGN $ODDHASH/;$MODIFY='Modification of a read-only value attempted';$REASSIGN='Attempt to reassign a readonly';$ODDHASH='May not store an odd number of values in a hash';package Readonly::Scalar;sub STORABLE_freeze {my ($self,$cloning)=@_;Readonly::_SCALAR($$self)if$cloning}sub TIESCALAR {my$whence =(caller 2)[3];Readonly::croak "Invalid tie" unless$whence && $whence =~ /^Readonly::(?:Scalar1?|Readonly)$/;my$class=shift;Readonly::croak "No value specified for readonly scalar" unless @_;Readonly::croak "Too many values specified for readonly scalar" unless @_==1;my$value=shift;return bless \$value,$class}sub FETCH {my$self=shift;return $$self}*STORE=*STORE=sub {Readonly::croak$Readonly::MODIFY};*UNTIE=*UNTIE =sub {Readonly::croak$Readonly::MODIFY if caller()ne 'Readonly'};package Readonly::Array;sub STORABLE_freeze {my ($self,$cloning)=@_;Readonly::_ARRAY(@$self)if$cloning}sub TIEARRAY {my$whence =(caller 1)[3];Readonly::croak "Invalid tie" unless$whence =~ /^Readonly::Array1?$/;my$class=shift;my@self=@_;return bless \@self,$class}sub FETCH {my$self=shift;my$index=shift;return$self->[$index]}sub FETCHSIZE {my$self=shift;return scalar @$self}BEGIN {eval q{ + sub EXISTS + { + my $self = shift; + my $index = shift; + return exists $self->[$index]; + } + } if $] >= 5.006}*STORE=*STORESIZE=*EXTEND=*PUSH=*POP=*UNSHIFT=*SHIFT=*SPLICE =*CLEAR=*STORE=*STORESIZE=*EXTEND=*PUSH=*POP=*UNSHIFT =*SHIFT=*SPLICE=*CLEAR=sub {Readonly::croak$Readonly::MODIFY};*UNTIE=*UNTIE =sub {Readonly::croak$Readonly::MODIFY if caller()ne 'Readonly'};package Readonly::Hash;sub STORABLE_freeze {my ($self,$cloning)=@_;Readonly::_HASH(%$self)if$cloning}sub TIEHASH {my$whence =(caller 1)[3];Readonly::croak "Invalid tie" unless$whence =~ /^Readonly::Hash1?$/;my$class=shift;Readonly::croak$Readonly::ODDHASH unless (@_ % 2==0);my%self=@_;return bless \%self,$class}sub FETCH {my$self=shift;my$key=shift;return$self->{$key}}sub EXISTS {my$self=shift;my$key=shift;return exists$self->{$key}}sub FIRSTKEY {my$self=shift;my$dummy=keys %$self;return scalar each %$self}sub NEXTKEY {my$self=shift;return scalar each %$self}*STORE=*DELETE=*CLEAR=*STORE=*DELETE=*CLEAR =sub {Readonly::croak$Readonly::MODIFY};*UNTIE=*UNTIE =sub {Readonly::croak$Readonly::MODIFY if caller()ne 'Readonly'};package Readonly;use Exporter;use vars qw/@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS/;push@ISA,'Exporter';push@EXPORT,qw/Readonly/;push@EXPORT_OK,qw/Scalar Array Hash Scalar1 Array1 Hash1/;sub Scalar ($$);sub Array (\@;@);sub Hash (\%;@);sub _is_badtype {my$type=$_[0];return lc$type if$type =~ s/^Readonly:://;return}sub Scalar1 ($$) {croak "$REASSIGN scalar" if is_sv_readonly($_[0]);my$badtype=_is_badtype(ref tied $_[0]);croak "$REASSIGN $badtype" if$badtype;if ($XSokay){$_[0]=$_[1];make_sv_readonly($_[0]);return}my$tieobj=eval {tie $_[0],'Readonly::Scalar',$_[1]};if ($@){croak "$REASSIGN scalar" if substr($@,0,43)eq $MODIFY;die $@}return$tieobj}sub Array1 (\@;@) {my$badtype=_is_badtype(ref tied $_[0]);croak "$REASSIGN $badtype" if$badtype;my$aref=shift;return tie @$aref,'Readonly::Array',@_}sub Hash1 (\%;@) {my$badtype=_is_badtype(ref tied $_[0]);croak "$REASSIGN $badtype" if$badtype;my$href=shift;if (@_==1 && ref $_[0]eq 'HASH'){return tie %$href,'Readonly::Hash',%{$_[0]}}croak$ODDHASH unless (@_ % 2==0);return tie %$href,'Readonly::Hash',@_}sub Scalar ($$) {croak "$REASSIGN scalar" if is_sv_readonly($_[0]);my$badtype=_is_badtype(ref tied $_[0]);croak "$REASSIGN $badtype" if$badtype;my$value=$_[1];for ($value){if (ref eq 'SCALAR'){Scalar my$v=>$$_;$_=\$v}elsif (ref eq 'ARRAY'){Array my@v=>@$_;$_=\@v}elsif (ref eq 'HASH'){Hash my%v=>$_;$_=\%v}}if ($XSokay){$_[0]=$value;make_sv_readonly($_[0]);return}my$tieobj=eval {tie $_[0],'Readonly::Scalar',$value};if ($@){croak "$REASSIGN scalar" if substr($@,0,43)eq $MODIFY;die $@}return$tieobj}sub Array (\@;@) {my$badtype=_is_badtype(ref tied @{$_[0]});croak "$REASSIGN $badtype" if$badtype;my$aref=shift;my@values=@_;for (@values){if (ref eq 'SCALAR'){Scalar my$v=>$$_;$_=\$v}elsif (ref eq 'ARRAY'){Array my@v=>@$_;$_=\@v}elsif (ref eq 'HASH'){Hash my%v=>$_;$_=\%v}}return tie @$aref,'Readonly::Array',@values}sub Hash (\%;@) {my$badtype=_is_badtype(ref tied %{$_[0]});croak "$REASSIGN $badtype" if$badtype;my$href=shift;my@values=@_;if (@_==1 && ref $_[0]eq 'HASH'){@values=%{$_[0]}}croak$ODDHASH unless (@values % 2==0);for (@values){if (ref eq 'SCALAR'){Scalar my$v=>$$_;$_=\$v}elsif (ref eq 'ARRAY'){Array my@v=>@$_;$_=\@v}elsif (ref eq 'HASH'){Hash my%v=>$_;$_=\%v}}return tie %$href,'Readonly::Hash',@values}sub Clone(\[$@%]) {require Storable;my$retval=Storable::dclone($_[0]);$retval=$$retval if ref$retval eq 'REF';my$reftype=ref$retval;if ($reftype eq 'SCALAR'){_SCALAR($retval);return $$retval}elsif ($reftype eq 'ARRAY'){_ARRAY(@$retval)}elsif ($reftype eq 'HASH'){_HASH(%$retval);return %$retval if wantarray}return$retval}eval q{sub Readonly} .($] < 5.008 ? '' : '(\[$@%]@)').<<'SUB_READONLY';1; + { + if (ref $_[0] eq 'SCALAR') + { + croak $MODIFY if is_sv_readonly ${$_[0]}; + my $badtype = _is_badtype (ref tied ${$_[0]}); + croak "$REASSIGN $badtype" if $badtype; + croak "Readonly scalar must have only one value" if @_ > 2; + + # Because of problems with handling \$ prototypes declarations like + # Readonly my @a = ... and Readonly my %h = ... are also caught here + croak 'Invalid initialization by assignment' + if @_ == 1 && defined ${$_[0]}; + + my $tieobj = eval {tie ${$_[0]}, 'Readonly::Scalar', $_[1]}; + # Tie may have failed because user tried to tie a constant, or we screwed up somehow. + if ($@) + { + croak $MODIFY if $@ =~ /^$MODIFY at/; # Point the finger at the user. + die "$@\n"; # Not a modify read-only message; must be our fault. + } + return $tieobj; + } + elsif (ref $_[0] eq 'ARRAY') + { + my $aref = shift; + return Array @$aref, @_; + } + elsif (ref $_[0] eq 'HASH') + { + my $href = shift; + croak $ODDHASH if @_%2 != 0 && !(@_ == 1 && ref $_[0] eq 'HASH'); + return Hash %$href, @_; + } + elsif (ref $_[0]) + { + croak "Readonly only supports scalar, array, and hash variables."; + } + else + { + croak "First argument to Readonly must be a reference."; + } + } + SUB_READONLY +READONLY + $fatpacked{"Sub/Exporter/Progressive.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'SUB_EXPORTER_PROGRESSIVE'; package Sub::Exporter::Progressive;$Sub::Exporter::Progressive::VERSION='0.001013';use strict;use warnings;sub _croak {require Carp;&Carp::croak}sub import {my ($self,@args)=@_;my$inner_target=caller;my$export_data=sub_export_options($inner_target,@args);my$full_exporter;no strict 'refs';no warnings 'once';@{"${inner_target}::EXPORT_OK"}=@{$export_data->{exports}};@{"${inner_target}::EXPORT"}=@{$export_data->{defaults}};%{"${inner_target}::EXPORT_TAGS"}=%{$export_data->{tags}};*{"${inner_target}::import"}=sub {use strict;my ($self,@args)=@_;if (grep {length ref $_ or $_ !~ / \A [:-]? \w+ \z /xm}@args){_croak 'your usage of Sub::Exporter::Progressive requires Sub::Exporter to be installed' unless eval {require Sub::Exporter};$full_exporter ||= Sub::Exporter::build_exporter($export_data->{original});goto$full_exporter}elsif (defined((my ($num)=grep {m/^\d/}@args)[0])){_croak "cannot export symbols with a leading digit: '$num'"}else {require Exporter;s/ \A - /:/xm for@args;@_=($self,@args);goto \&Exporter::import}};return}my$too_complicated=<<'DEATH';sub sub_export_options {my ($inner_target,$setup,$options)=@_;my@exports;my@defaults;my%tags;if (($setup||'')eq '-setup'){my%options=%$options;OPTIONS: for my$opt (keys%options){if ($opt eq 'exports'){_croak$too_complicated if ref$options{exports}ne 'ARRAY';@exports=@{$options{exports}};_croak$too_complicated if grep {length ref $_}@exports}elsif ($opt eq 'groups'){%tags=%{$options{groups}};for my$tagset (values%tags){_croak$too_complicated if grep {length ref $_ or $_ =~ / \A - (?! all \b ) /x}@{$tagset}}@defaults=@{$tags{default}|| []}}else {_croak$too_complicated}}@{$_}=map {/ \A [:-] all \z /x ? @exports : $_}@{$_}for \@defaults,values%tags;$tags{all}||= [@exports ];my%exports=map {$_=>1}@exports;my@errors=grep {not $exports{$_}}@defaults;_croak join(', ',@errors)." is not exported by the $inner_target module\n" if@errors}return {exports=>\@exports,defaults=>\@defaults,original=>$options,tags=>\%tags,}}1; You are using Sub::Exporter::Progressive, but the features your program uses from @@ -324,282 +346,10 @@ $fatpacked{"Text/Table/Any.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<' package Text::Table::Any;our$DATE='2019-11-29';our$VERSION='0.096';our@BACKENDS=qw(Text::Table::Tiny Text::Table::TinyColor Text::Table::TinyColorWide Text::Table::TinyWide Text::Table::Org Text::Table::CSV Text::Table::TSV Text::Table::LTSV Text::Table::ASV Text::Table::HTML Text::Table::HTML::DataTables Text::Table::Paragraph Text::ANSITable Text::ASCIITable Text::FormatTable Text::MarkdownTable Text::Table Text::TabularDisplay Text::Table::XLSX Term::TablePrint);sub _encode {my$val=shift;$val =~ s/([\\"])/\\$1/g;"\"$val\""}sub backends {@BACKENDS}sub table {my%params=@_;my$rows=$params{rows}or die "Must provide rows!";my$backend=$params{backend}|| 'Text::Table::Tiny';my$header_row=$params{header_row}// 1;if ($backend eq 'Text::Table::Tiny'){require Text::Table::Tiny;return Text::Table::Tiny::table(rows=>$rows,header_row=>$header_row)."\n"}elsif ($backend eq 'Text::Table::TinyColor'){require Text::Table::TinyColor;return Text::Table::TinyColor::table(rows=>$rows,header_row=>$header_row)."\n"}elsif ($backend eq 'Text::Table::TinyColorWide'){require Text::Table::TinyColorWide;return Text::Table::TinyColorWide::table(rows=>$rows,header_row=>$header_row)."\n"}elsif ($backend eq 'Text::Table::TinyWide'){require Text::Table::TinyWide;return Text::Table::TinyWide::table(rows=>$rows,header_row=>$header_row)."\n"}elsif ($backend eq 'Text::Table::Org'){require Text::Table::Org;return Text::Table::Org::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::Table::CSV'){require Text::Table::CSV;return Text::Table::CSV::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::Table::TSV'){require Text::Table::TSV;return Text::Table::TSV::table(rows=>$rows)}elsif ($backend eq 'Text::Table::LTSV'){require Text::Table::LTSV;return Text::Table::LTSV::table(rows=>$rows)}elsif ($backend eq 'Text::Table::ASV'){require Text::Table::ASV;return Text::Table::ASV::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::Table::HTML'){require Text::Table::HTML;return Text::Table::HTML::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::Table::HTML::DataTables'){require Text::Table::HTML::DataTables;return Text::Table::HTML::DataTables::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::Table::Paragraph'){require Text::Table::Paragraph;return Text::Table::Paragraph::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Text::ANSITable'){require Text::ANSITable;my$t=Text::ANSITable->new(use_utf8=>0,use_box_chars=>0,use_color=>0,border_style=>'Default::single_ascii',);if ($header_row){$t->columns($rows->[0]);$t->add_row($rows->[$_])for 1..@$rows-1}else {$t->columns([map {"col$_"}0..$#{$rows->[0]}]);$t->add_row($_)for @$rows}return$t->draw}elsif ($backend eq 'Text::ASCIITable'){require Text::ASCIITable;my$t=Text::ASCIITable->new();if ($header_row){$t->setCols(@{$rows->[0]});$t->addRow(@{$rows->[$_]})for 1..@$rows-1}else {$t->setCols(map {"col$_"}0..$#{$rows->[0]});$t->addRow(@$_)for @$rows}return "$t"}elsif ($backend eq 'Text::FormatTable'){require Text::FormatTable;my$t=Text::FormatTable->new(join('|',('l')x @{$rows->[0]}));$t->head(@{$rows->[0]});$t->row(@{$rows->[$_]})for 1..@$rows-1;return$t->render}elsif ($backend eq 'Text::MarkdownTable'){require Text::MarkdownTable;my$out="";my$fields=$header_row ? $rows->[0]: [map {"col$_"}0..$#{$rows->[0]}];my$t=Text::MarkdownTable->new(file=>\$out,columns=>$fields);for (($header_row ? 1:0).. $#{$rows}){my$row=$rows->[$_];$t->add({map {$fields->[$_]=>$row->[$_]}0..@$fields-1 })}$t->done;return$out}elsif ($backend eq 'Text::Table'){require Text::Table;my$t=Text::Table->new(@{$rows->[0]});$t->load(@{$rows}[1..@$rows-1]);return$t}elsif ($backend eq 'Text::TabularDisplay'){require Text::TabularDisplay;my$t=Text::TabularDisplay->new(@{$rows->[0]});$t->add(@{$rows->[$_]})for 1..@$rows-1;return$t->render ."\n"}elsif ($backend eq 'Text::Table::XLSX'){require Text::Table::XLSX;return Text::Table::XLSX::table(rows=>$rows,header_row=>$header_row)}elsif ($backend eq 'Term::TablePrint'){require Term::TablePrint;my$rows2;if ($header_row){$rows2=$rows}else {$rows2=[@$rows];shift @$rows2}return Term::TablePrint::print_table($rows)}else {die "Unknown backend '$backend'"}}1; TEXT_TABLE_ANY -$fatpacked{"Text/Table/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TEXT_TABLE_TINY'; - use 5.006;use strict;use warnings;package Text::Table::Tiny;$Text::Table::Tiny::VERSION='0.05';use parent 'Exporter';use List::Util qw();use Carp qw/croak/;our@EXPORT_OK=qw/generate_table/;our$COLUMN_SEPARATOR='|';our$ROW_SEPARATOR='-';our$CORNER_MARKER='+';our$HEADER_ROW_SEPARATOR='=';our$HEADER_CORNER_MARKER='O';sub generate_table {my%params=@_;my$rows=$params{rows}or croak "generate_table(): you must pass the 'rows' argument!";my$widths=_maxwidths($rows);my$max_index=_max_array_index($rows);my$format=_get_format($widths);my$row_sep=_get_row_separator($widths);my$head_row_sep=_get_header_row_separator($widths);my@table;push(@table,$row_sep)unless$params{top_and_tail};my$data_begins=0;if ($params{header_row}){my$header_row=$rows->[0];$data_begins++;push@table,sprintf($format,map {defined($header_row->[$_])? $header_row->[$_]: ''}(0..$max_index));push@table,$params{separate_rows}? $head_row_sep : $row_sep}my$row_number=0;my$last_line_number=int(@$rows);$last_line_number-- if$params{header_row};for my$row (@{$rows}[$data_begins..$#$rows]){$row_number++;push(@table,sprintf($format,map {defined($row->[$_])? $row->[$_]: ''}(0..$max_index)));push(@table,$row_sep)if$params{separate_rows}&& (!$params{top_and_tail}|| $row_number < $last_line_number)}push(@table,$row_sep)unless$params{separate_rows}|| $params{top_and_tail};return join("\n",grep {$_}@table)}sub _maxwidths {my$rows=shift;my$max_index=_max_array_index($rows);my$widths=[];for my$i (0..$max_index){my$max=List::Util::max(map {defined $$_[$i]? length($$_[$i]): 0}@$rows);push @$widths,$max}return$widths}sub _max_array_index {my$rows=shift;return List::Util::max(map {$#$_}@$rows)}sub _get_format {my$widths=shift;return "$COLUMN_SEPARATOR ".join(" $COLUMN_SEPARATOR ",map {"%-${_}s"}@$widths)." $COLUMN_SEPARATOR"}sub _get_row_separator {my$widths=shift;return "$CORNER_MARKER$ROW_SEPARATOR".join("$ROW_SEPARATOR$CORNER_MARKER$ROW_SEPARATOR",map {$ROW_SEPARATOR x $_}@$widths)."$ROW_SEPARATOR$CORNER_MARKER"}sub _get_header_row_separator {my$widths=shift;return "$HEADER_CORNER_MARKER$HEADER_ROW_SEPARATOR".join("$HEADER_ROW_SEPARATOR$HEADER_CORNER_MARKER$HEADER_ROW_SEPARATOR",map {$HEADER_ROW_SEPARATOR x $_}@$widths)."$HEADER_ROW_SEPARATOR$HEADER_CORNER_MARKER"}*table=\&generate_table;1; -TEXT_TABLE_TINY - $fatpacked{"Try/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TRY_TINY'; package Try::Tiny;use 5.006;our$VERSION='0.30';use strict;use warnings;use Exporter 5.57 'import';our@EXPORT=our@EXPORT_OK=qw(try catch finally);use Carp;$Carp::Internal{+__PACKAGE__}++;BEGIN {my$su=$INC{'Sub/Util.pm'}&& defined&Sub::Util::set_subname;my$sn=$INC{'Sub/Name.pm'}&& eval {Sub::Name->VERSION(0.08)};unless ($su || $sn){$su=eval {require Sub::Util}&& defined&Sub::Util::set_subname;unless ($su){$sn=eval {require Sub::Name;Sub::Name->VERSION(0.08)}}}*_subname=$su ? \&Sub::Util::set_subname : $sn ? \&Sub::Name::subname : sub {$_[1]};*_HAS_SUBNAME=($su || $sn)? sub(){1}: sub(){0}}my%_finally_guards;sub try (&;@) {my ($try,@code_refs)=@_;my$wantarray=wantarray;my ($catch,@finally)=();for my$code_ref (@code_refs){if (ref($code_ref)eq 'Try::Tiny::Catch'){croak 'A try() may not be followed by multiple catch() blocks' if$catch;$catch=${$code_ref}}elsif (ref($code_ref)eq 'Try::Tiny::Finally'){push@finally,${$code_ref}}else {croak('try() encountered an unexpected argument (' .(defined$code_ref ? $code_ref : 'undef').') - perhaps a missing semi-colon before or')}}_subname(caller().'::try {...} '=>$try)if _HAS_SUBNAME;local$_finally_guards{guards}=[map {Try::Tiny::ScopeGuard->_new($_)}@finally ];my$prev_error=$@;my (@ret,$error);my$failed=not eval {$@=$prev_error;if ($wantarray){@ret=$try->()}elsif (defined$wantarray){$ret[0]=$try->()}else {$try->()};return 1};$error=$@;$@=$prev_error;if ($failed){push @$_,$error for @{$_finally_guards{guards}};if ($catch){for ($error){return$catch->($error)}}return}else {return$wantarray ? @ret : $ret[0]}}sub catch (&;@) {my ($block,@rest)=@_;croak 'Useless bare catch()' unless wantarray;_subname(caller().'::catch {...} '=>$block)if _HAS_SUBNAME;return (bless(\$block,'Try::Tiny::Catch'),@rest,)}sub finally (&;@) {my ($block,@rest)=@_;croak 'Useless bare finally()' unless wantarray;_subname(caller().'::finally {...} '=>$block)if _HAS_SUBNAME;return (bless(\$block,'Try::Tiny::Finally'),@rest,)}{package Try::Tiny::ScopeGuard;use constant UNSTABLE_DOLLARAT=>("$]" < '5.013002')? 1 : 0;sub _new {shift;bless [@_ ]}sub DESTROY {my ($code,@args)=@{$_[0]};local $@ if UNSTABLE_DOLLARAT;eval {$code->(@args);1}or do {warn "Execution of finally() block $code resulted in an exception, which " .'*CAN NOT BE PROPAGATED* due to fundamental limitations of Perl. ' .'Your program will continue as if this event never took place. ' ."Original exception text follows:\n\n" .(defined $@ ? $@ : '$@ left undefined...')."\n" }}}__PACKAGE__ TRY_TINY -$fatpacked{"YAML.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML'; - package YAML;our$VERSION='1.30';use YAML::Mo;use Exporter;push@YAML::ISA,'Exporter';our@EXPORT=qw{Dump Load};our@EXPORT_OK=qw{freeze thaw DumpFile LoadFile Bless Blessed};our ($UseCode,$DumpCode,$LoadCode,$SpecVersion,$UseHeader,$UseVersion,$UseBlock,$UseFold,$UseAliases,$Indent,$SortKeys,$Preserve,$AnchorPrefix,$CompressSeries,$InlineSeries,$Purity,$Stringify,$Numify,$LoadBlessed,$QuoteNumericStrings,$DumperClass,$LoaderClass);use YAML::Node;use Scalar::Util qw/openhandle/;use constant VALUE=>"\x07YAML\x07VALUE\x07";has dumper_class=>default=>sub {'YAML::Dumper'};has loader_class=>default=>sub {'YAML::Loader'};has dumper_object=>default=>sub {$_[0]->init_action_object("dumper")};has loader_object=>default=>sub {$_[0]->init_action_object("loader")};sub Dump {my$yaml=YAML->new;$yaml->dumper_class($YAML::DumperClass)if$YAML::DumperClass;return$yaml->dumper_object->dump(@_)}sub Load {my$yaml=YAML->new;$yaml->loader_class($YAML::LoaderClass)if$YAML::LoaderClass;return$yaml->loader_object->load(@_)}{no warnings 'once';*freeze=\ &Dump;*thaw=\ &Load}sub DumpFile {my$OUT;my$filename=shift;if (openhandle$filename){$OUT=$filename}else {my$mode='>';if ($filename =~ /^\s*(>{1,2})\s*(.*)$/){($mode,$filename)=($1,$2)}open$OUT,$mode,$filename or YAML::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT',$filename,"$!")}binmode$OUT,':utf8';local $/="\n";print$OUT Dump(@_);unless (ref$filename eq 'GLOB'){close$OUT or do {my$errsav=$!;YAML::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT_CLOSE',$filename,$errsav)}}}sub LoadFile {my$IN;my$filename=shift;if (openhandle$filename){$IN=$filename}else {open$IN,'<',$filename or YAML::Mo::Object->die('YAML_LOAD_ERR_FILE_INPUT',$filename,"$!")}binmode$IN,':utf8';return Load(do {local $/;<$IN>})}sub init_action_object {my$self=shift;my$object_class=(shift).'_class';my$module_name=$self->$object_class;eval "require $module_name";$self->die("Error in require $module_name - $@")if $@ and "$@" !~ /Can't locate/;my$object=$self->$object_class->new;$object->set_global_options;return$object}my$global={};sub Bless {require YAML::Dumper::Base;YAML::Dumper::Base::bless($global,@_)}sub Blessed {require YAML::Dumper::Base;YAML::Dumper::Base::blessed($global,@_)}sub global_object {$global}1; -YAML - -$fatpacked{"YAML/Any.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_ANY'; - use strict;use warnings;package YAML::Any;our$VERSION='1.30';use Exporter ();@YAML::Any::ISA='Exporter';@YAML::Any::EXPORT=qw(Dump Load);@YAML::Any::EXPORT_OK=qw(DumpFile LoadFile);my@dump_options=qw(UseCode DumpCode SpecVersion Indent UseHeader UseVersion SortKeys AnchorPrefix UseBlock UseFold CompressSeries InlineSeries UseAliases Purity Stringify);my@load_options=qw(UseCode LoadCode Preserve);my@implementations=qw(YAML::XS YAML::Syck YAML::Old YAML YAML::Tiny);sub import {__PACKAGE__->implementation;goto&Exporter::import}sub Dump {no strict 'refs';no warnings 'once';my$implementation=__PACKAGE__->implementation;for my$option (@dump_options){my$var="$implementation\::$option";my$value=$$var;local $$var;$$var=defined$value ? $value : ${"YAML::$option"}}return &{"$implementation\::Dump"}(@_)}sub DumpFile {no strict 'refs';no warnings 'once';my$implementation=__PACKAGE__->implementation;for my$option (@dump_options){my$var="$implementation\::$option";my$value=$$var;local $$var;$$var=defined$value ? $value : ${"YAML::$option"}}return &{"$implementation\::DumpFile"}(@_)}sub Load {no strict 'refs';no warnings 'once';my$implementation=__PACKAGE__->implementation;for my$option (@load_options){my$var="$implementation\::$option";my$value=$$var;local $$var;$$var=defined$value ? $value : ${"YAML::$option"}}return &{"$implementation\::Load"}(@_)}sub LoadFile {no strict 'refs';no warnings 'once';my$implementation=__PACKAGE__->implementation;for my$option (@load_options){my$var="$implementation\::$option";my$value=$$var;local $$var;$$var=defined$value ? $value : ${"YAML::$option"}}return &{"$implementation\::LoadFile"}(@_)}sub order {return@YAML::Any::_TEST_ORDER if@YAML::Any::_TEST_ORDER;return@implementations}sub implementation {my@order=__PACKAGE__->order;for my$module (@order){my$path=$module;$path =~ s/::/\//g;$path .= '.pm';return$module if exists$INC{$path};eval "require $module; 1" and return$module}croak("YAML::Any couldn't find any of these YAML implementations: @order")}sub croak {require Carp;Carp::croak(@_)}1; -YAML_ANY - -$fatpacked{"YAML/Dumper.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_DUMPER'; - package YAML::Dumper;use YAML::Mo;extends 'YAML::Dumper::Base';use YAML::Dumper::Base;use YAML::Node;use YAML::Types;use Scalar::Util qw();use B ();use Carp ();use constant KEY=>3;use constant BLESSED=>4;use constant FROMARRAY=>5;use constant VALUE=>"\x07YAML\x07VALUE\x07";my$ESCAPE_CHAR='[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f]';my$LIT_CHAR='|';sub dump {my$self=shift;$self->stream('');$self->document(0);for my$document (@_){$self->{document}++;$self->transferred({});$self->id_refcnt({});$self->id_anchor({});$self->anchor(1);$self->level(0);$self->offset->[0]=0 - $self->indent_width;$self->_prewalk($document);$self->_emit_header($document);$self->_emit_node($document)}return$self->stream}sub _emit_header {my$self=shift;my ($node)=@_;if (not $self->use_header and $self->document==1){$self->die('YAML_DUMP_ERR_NO_HEADER')unless ref($node)=~ /^(HASH|ARRAY)$/;$self->die('YAML_DUMP_ERR_NO_HEADER')if ref($node)eq 'HASH' and keys(%$node)==0;$self->die('YAML_DUMP_ERR_NO_HEADER')if ref($node)eq 'ARRAY' and @$node==0;$self->headless(1);return}$self->{stream}.= '---';if ($self->use_version){}}sub _prewalk {my$self=shift;my$stringify=$self->stringify;my ($class,$type,$node_id)=$self->node_info(\$_[0],$stringify);if ($type eq 'GLOB'){$self->transferred->{$node_id}=YAML::Type::glob->yaml_dump($_[0]);$self->_prewalk($self->transferred->{$node_id});return}if (ref($_[0])eq 'Regexp'){return}if (not ref $_[0]){$self->{id_refcnt}{$node_id}++ if$self->purity;return}my$value=$_[0];($class,$type,$node_id)=$self->node_info($value,$stringify);return if (ref($value)and not $type);if ($self->transferred->{$node_id}){(undef,undef,$node_id)=(ref$self->transferred->{$node_id})? $self->node_info($self->transferred->{$node_id},$stringify): $self->node_info(\ $self->transferred->{$node_id},$stringify);$self->{id_refcnt}{$node_id}++;return}if ($type eq 'CODE'){$self->transferred->{$node_id}='placeholder';YAML::Type::code->yaml_dump($self->dump_code,$_[0],$self->transferred->{$node_id});($class,$type,$node_id)=$self->node_info(\ $self->transferred->{$node_id},$stringify);$self->{id_refcnt}{$node_id}++;return}if (defined$class){if ($value->can('yaml_dump')){$value=$value->yaml_dump}elsif ($type eq 'SCALAR'){$self->transferred->{$node_id}='placeholder';YAML::Type::blessed->yaml_dump ($_[0],$self->transferred->{$node_id});($class,$type,$node_id)=$self->node_info(\ $self->transferred->{$node_id},$stringify);$self->{id_refcnt}{$node_id}++;return}else {$value=YAML::Type::blessed->yaml_dump($value)}$self->transferred->{$node_id}=$value;(undef,$type,$node_id)=$self->node_info($value,$stringify)}require YAML;if (defined YAML->global_object()->{blessed_map}{$node_id}){$value=YAML->global_object()->{blessed_map}{$node_id};$self->transferred->{$node_id}=$value;($class,$type,$node_id)=$self->node_info($value,$stringify);$self->_prewalk($value);return}if ($type eq 'REF' or $type eq 'SCALAR'){$value=YAML::Type::ref->yaml_dump($value);$self->transferred->{$node_id}=$value;(undef,$type,$node_id)=$self->node_info($value,$stringify)}elsif ($type eq 'GLOB'){my$ref_ynode=$self->transferred->{$node_id}=YAML::Type::ref->yaml_dump($value);my$glob_ynode=$ref_ynode->{&VALUE}=YAML::Type::glob->yaml_dump($$value);(undef,undef,$node_id)=$self->node_info($glob_ynode,$stringify);$self->transferred->{$node_id}=$glob_ynode;$self->_prewalk($glob_ynode);return}return if ++($self->{id_refcnt}{$node_id})> 1;if ($type eq 'HASH'){$self->_prewalk($value->{$_})for keys %{$value};return}elsif ($type eq 'ARRAY'){$self->_prewalk($_)for @{$value};return}$self->warn(<<"...");return}sub _emit_node {my$self=shift;my ($type,$node_id);my$ref=ref($_[0]);if ($ref){if ($ref eq 'Regexp'){$self->_emit(' !!perl/regexp');$self->_emit_str("$_[0]");return}(undef,$type,$node_id)=$self->node_info($_[0],$self->stringify)}else {$type=$ref || 'SCALAR';(undef,undef,$node_id)=$self->node_info(\$_[0],$self->stringify)}my ($ynode,$tag)=('')x 2;my ($value,$context)=(@_,0);if (defined$self->transferred->{$node_id}){$value=$self->transferred->{$node_id};$ynode=ynode($value);if (ref$value){$tag=defined$ynode ? $ynode->tag->short : '';(undef,$type,$node_id)=$self->node_info($value,$self->stringify)}else {$ynode=ynode($self->transferred->{$node_id});$tag=defined$ynode ? $ynode->tag->short : '';$type='SCALAR';(undef,undef,$node_id)=$self->node_info(\ $self->transferred->{$node_id},$self->stringify)}}elsif ($ynode=ynode($value)){$tag=$ynode->tag->short}if ($self->use_aliases){$self->{id_refcnt}{$node_id}||= 0;if ($self->{id_refcnt}{$node_id}> 1){if (defined$self->{id_anchor}{$node_id}){$self->{stream}.= ' *' .$self->{id_anchor}{$node_id}."\n";return}my$anchor=$self->anchor_prefix .$self->{anchor}++;$self->{stream}.= ' &' .$anchor;$self->{id_anchor}{$node_id}=$anchor}}return$self->_emit_str("$value")if ref($value)and not $type;return$self->_emit_scalar($value,$tag)if$type eq 'SCALAR' and $tag;return$self->_emit_str($value)if$type eq 'SCALAR';return$self->_emit_mapping($value,$tag,$node_id,$context)if$type eq 'HASH';return$self->_emit_sequence($value,$tag)if$type eq 'ARRAY';$self->warn('YAML_DUMP_WARN_BAD_NODE_TYPE',$type);return$self->_emit_str("$value")}sub _emit_mapping {my$self=shift;my ($value,$tag,$node_id,$context)=@_;$self->{stream}.= " !$tag" if$tag;my$empty_hash=not(eval {keys %$value});$self->warn('YAML_EMIT_WARN_KEYS',$@)if $@;return ($self->{stream}.= " {}\n")if$empty_hash;if ($context==FROMARRAY and $self->compress_series and not (defined$self->{id_anchor}{$node_id}or $tag or $empty_hash)){$self->{stream}.= ' ';$self->offset->[$self->level+1]=$self->offset->[$self->level]+ 2}else {$context=0;$self->{stream}.= "\n" unless$self->headless && not($self->headless(0));$self->offset->[$self->level+1]=$self->offset->[$self->level]+ $self->indent_width}$self->{level}++;my@keys;if ($self->sort_keys==1){if (ynode($value)){@keys=keys %$value}else {@keys=sort keys %$value}}elsif ($self->sort_keys==2){@keys=sort keys %$value}elsif (ref($self->sort_keys)eq 'ARRAY'){my$i=1;my%order=map {($_,$i++)}@{$self->sort_keys};@keys=sort {(defined$order{$a}and defined$order{$b})? ($order{$a}<=> $order{$b}): ($a cmp $b)}keys %$value}else {@keys=keys %$value}if (exists$value->{&VALUE}){for (my$i=0;$i < @keys;$i++){if ($keys[$i]eq &VALUE){splice(@keys,$i,1);push@keys,&VALUE;last}}}for my$key (@keys){$self->_emit_key($key,$context);$context=0;$self->{stream}.= ':';$self->_emit_node($value->{$key})}$self->{level}--}sub _emit_sequence {my$self=shift;my ($value,$tag)=@_;$self->{stream}.= " !$tag" if$tag;return ($self->{stream}.= " []\n")if @$value==0;$self->{stream}.= "\n" unless$self->headless && not($self->headless(0));if ($self->inline_series and @$value <= $self->inline_series and not (scalar grep {ref or /\n/}@$value)){$self->{stream}=~ s/\n\Z/ /;$self->{stream}.= '[';for (my$i=0;$i < @$value;$i++){$self->_emit_str($value->[$i],KEY);last if$i==$#{$value};$self->{stream}.= ', '}$self->{stream}.= "]\n";return}$self->offset->[$self->level + 1]=$self->offset->[$self->level]+ $self->indent_width;$self->{level}++;for my$val (@$value){$self->{stream}.= ' ' x $self->offset->[$self->level];$self->{stream}.= '-';$self->_emit_node($val,FROMARRAY)}$self->{level}--}sub _emit_key {my$self=shift;my ($value,$context)=@_;$self->{stream}.= ' ' x $self->offset->[$self->level]unless$context==FROMARRAY;$self->_emit_str($value,KEY)}sub _emit_scalar {my$self=shift;my ($value,$tag)=@_;$self->{stream}.= " !$tag";$self->_emit_str($value,BLESSED)}sub _emit {my$self=shift;$self->{stream}.= join '',@_}sub _emit_str {my$self=shift;my$type=$_[1]|| 0;$self->offset->[$self->level + 1]=$self->offset->[$self->level]+ $self->indent_width;$self->{level}++;my$sf=$type==KEY ? '' : ' ';my$sb=$type==KEY ? '? ' : ' ';my$ef=$type==KEY ? '' : "\n";my$eb="\n";while (1){$self->_emit($sf),$self->_emit_plain($_[0]),$self->_emit($ef),last if not defined $_[0];$self->_emit($sf,'=',$ef),last if $_[0]eq VALUE;$self->_emit($sf),$self->_emit_double($_[0]),$self->_emit($ef),last if $_[0]=~ /$ESCAPE_CHAR/;if ($_[0]=~ /\n/){$self->_emit($sb),$self->_emit_block($LIT_CHAR,$_[0]),$self->_emit($eb),last if$self->use_block;Carp::cluck "[YAML] \$UseFold is no longer supported" if$self->use_fold;$self->_emit($sf),$self->_emit_double($_[0]),$self->_emit($ef),last if length $_[0]<= 30;$self->_emit($sf),$self->_emit_double($_[0]),$self->_emit($ef),last if $_[0]!~ /\n\s*\S/;$self->_emit($sb),$self->_emit_block($LIT_CHAR,$_[0]),$self->_emit($eb),last}$self->_emit($sf),$self->_emit_number($_[0]),$self->_emit($ef),last if$self->is_literal_number($_[0]);$self->_emit($sf),$self->_emit_plain($_[0]),$self->_emit($ef),last if$self->is_valid_plain($_[0]);$self->_emit($sf),$self->_emit_double($_[0]),$self->_emit($ef),last if $_[0]=~ /'/;$self->_emit($sf),$self->_emit_single($_[0]),$self->_emit($ef);last}$self->{level}--;return}sub is_literal_number {my$self=shift;return B::svref_2object(\$_[0])->FLAGS & (B::SVp_IOK | B::SVp_NOK)&& 0 + $_[0]eq $_[0]}sub _emit_number {my$self=shift;return$self->_emit_plain($_[0])}sub is_valid_plain {my$self=shift;return 0 unless length $_[0];return 0 if$self->quote_numeric_strings and Scalar::Util::looks_like_number($_[0]);return 0 if $_[0]=~ /^[\s\{\[\~\`\'\"\!\@\#\>\|\%\&\?\*\^]/;return 0 if $_[0]=~ /[\{\[\]\},]/;return 0 if $_[0]=~ /[:\-\?]\s/;return 0 if $_[0]=~ /\s#/;return 0 if $_[0]=~ /\:(\s|$)/;return 0 if $_[0]=~ /[\s\|\>]$/;return 0 if $_[0]eq '-';return 0 if $_[0]eq '=';return 1}sub _emit_block {my$self=shift;my ($indicator,$value)=@_;$self->{stream}.= $indicator;$value =~ /(\n*)\Z/;my$chomp=length $1 ? (length $1 > 1)? '+' : '' : '-';$value='~' if not defined$value;$self->{stream}.= $chomp;$self->{stream}.= $self->indent_width if$value =~ /^\s/;$self->{stream}.= $self->indent($value)}sub _emit_plain {my$self=shift;$self->{stream}.= defined $_[0]? $_[0]: '~'}sub _emit_double {my$self=shift;(my$escaped=$self->escape($_[0]))=~ s/"/\\"/g;$self->{stream}.= qq{"$escaped"}}sub _emit_single {my$self=shift;my$item=shift;$item =~ s{'}{''}g;$self->{stream}.= "'$item'"}sub indent {my$self=shift;my ($text)=@_;return$text unless length$text;$text =~ s/\n\Z//;my$indent=' ' x $self->offset->[$self->level];$text =~ s/^/$indent/gm;$text="\n$text";return$text}my@escapes=qw(\0 \x01 \x02 \x03 \x04 \x05 \x06 \a \x08 \t \n \v \f \r \x0e \x0f \x10 \x11 \x12 \x13 \x14 \x15 \x16 \x17 \x18 \x19 \x1a \e \x1c \x1d \x1e \x1f);sub escape {my$self=shift;my ($text)=@_;$text =~ s/\\/\\\\/g;$text =~ s/([\x00-\x1f])/$escapes[ord($1)]/ge;return$text}1; - YAML::Dumper can't handle dumping this type of data. - Please report this to the author. - - id: $node_id - type: $type - class: $class - value: $value - - ... -YAML_DUMPER - -$fatpacked{"YAML/Dumper/Base.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_DUMPER_BASE'; - package YAML::Dumper::Base;use YAML::Mo;use YAML::Node;has spec_version=>default=>sub {'1.0'};has indent_width=>default=>sub {2};has use_header=>default=>sub {1};has use_version=>default=>sub {0};has sort_keys=>default=>sub {1};has anchor_prefix=>default=>sub {''};has dump_code=>default=>sub {0};has use_block=>default=>sub {0};has use_fold=>default=>sub {0};has compress_series=>default=>sub {1};has inline_series=>default=>sub {0};has use_aliases=>default=>sub {1};has purity=>default=>sub {0};has stringify=>default=>sub {0};has quote_numeric_strings=>default=>sub {0};has stream=>default=>sub {''};has document=>default=>sub {0};has transferred=>default=>sub {{}};has id_refcnt=>default=>sub {{}};has id_anchor=>default=>sub {{}};has anchor=>default=>sub {1};has level=>default=>sub {0};has offset=>default=>sub {[]};has headless=>default=>sub {0};has blessed_map=>default=>sub {{}};sub set_global_options {my$self=shift;$self->spec_version($YAML::SpecVersion)if defined$YAML::SpecVersion;$self->indent_width($YAML::Indent)if defined$YAML::Indent;$self->use_header($YAML::UseHeader)if defined$YAML::UseHeader;$self->use_version($YAML::UseVersion)if defined$YAML::UseVersion;$self->sort_keys($YAML::SortKeys)if defined$YAML::SortKeys;$self->anchor_prefix($YAML::AnchorPrefix)if defined$YAML::AnchorPrefix;$self->dump_code($YAML::DumpCode || $YAML::UseCode)if defined$YAML::DumpCode or defined$YAML::UseCode;$self->use_block($YAML::UseBlock)if defined$YAML::UseBlock;$self->use_fold($YAML::UseFold)if defined$YAML::UseFold;$self->compress_series($YAML::CompressSeries)if defined$YAML::CompressSeries;$self->inline_series($YAML::InlineSeries)if defined$YAML::InlineSeries;$self->use_aliases($YAML::UseAliases)if defined$YAML::UseAliases;$self->purity($YAML::Purity)if defined$YAML::Purity;$self->stringify($YAML::Stringify)if defined$YAML::Stringify;$self->quote_numeric_strings($YAML::QuoteNumericStrings)if defined$YAML::QuoteNumericStrings}sub dump {my$self=shift;$self->die('dump() not implemented in this class.')}sub blessed {my$self=shift;my ($ref)=@_;$ref=\$_[0]unless ref$ref;my (undef,undef,$node_id)=YAML::Mo::Object->node_info($ref);$self->{blessed_map}->{$node_id}}sub bless {my$self=shift;my ($ref,$blessing)=@_;my$ynode;$ref=\$_[0]unless ref$ref;my (undef,undef,$node_id)=YAML::Mo::Object->node_info($ref);if (not defined$blessing){$ynode=YAML::Node->new($ref)}elsif (ref$blessing){$self->die()unless ynode($blessing);$ynode=$blessing}else {no strict 'refs';my$transfer=$blessing ."::yaml_dump";$self->die()unless defined &{$transfer};$ynode=&{$transfer}($ref);$self->die()unless ynode($ynode)}$self->{blessed_map}->{$node_id}=$ynode;my$object=ynode($ynode)or $self->die();return$object}1; -YAML_DUMPER_BASE - -$fatpacked{"YAML/Error.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_ERROR'; - package YAML::Error;use YAML::Mo;has 'code';has 'type'=>default=>sub {'Error'};has 'line';has 'document';has 'arguments'=>default=>sub {[]};my ($error_messages,%line_adjust);sub format_message {my$self=shift;my$output='YAML ' .$self->type .': ';my$code=$self->code;if ($error_messages->{$code}){$code=sprintf($error_messages->{$code},@{$self->arguments})}$output .= $code ."\n";$output .= ' Code: ' .$self->code ."\n" if defined$self->code;$output .= ' Line: ' .$self->line ."\n" if defined$self->line;$output .= ' Document: ' .$self->document ."\n" if defined$self->document;return$output}sub error_messages {$error_messages}%$error_messages=map {s/^\s+//;s/\\n/\n/;$_}split "\n",<<'...';%line_adjust=map {($_,1)}qw(YAML_PARSE_ERR_BAD_MAJOR_VERSION YAML_PARSE_WARN_BAD_MINOR_VERSION YAML_PARSE_ERR_TEXT_AFTER_INDICATOR YAML_PARSE_ERR_NO_ANCHOR YAML_PARSE_ERR_MANY_EXPLICIT YAML_PARSE_ERR_MANY_IMPLICIT YAML_PARSE_ERR_MANY_ANCHOR YAML_PARSE_ERR_ANCHOR_ALIAS YAML_PARSE_ERR_BAD_ALIAS YAML_PARSE_ERR_MANY_ALIAS YAML_LOAD_ERR_NO_CONVERT YAML_LOAD_ERR_NO_DEFAULT_VALUE YAML_LOAD_ERR_NON_EMPTY_STRING YAML_LOAD_ERR_BAD_MAP_TO_SEQ YAML_LOAD_ERR_BAD_STR_TO_INT YAML_LOAD_ERR_BAD_STR_TO_DATE YAML_LOAD_ERR_BAD_STR_TO_TIME YAML_LOAD_WARN_DUPLICATE_KEY YAML_PARSE_ERR_INLINE_MAP YAML_PARSE_ERR_INLINE_SEQUENCE YAML_PARSE_ERR_BAD_DOUBLE YAML_PARSE_ERR_BAD_SINGLE YAML_PARSE_ERR_BAD_INLINE_IMPLICIT YAML_PARSE_ERR_BAD_IMPLICIT YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP YAML_LOAD_WARN_BAD_REGEXP_ELEM YAML_LOAD_WARN_REGEXP_CREATE YAML_LOAD_WARN_GLOB_NAME YAML_LOAD_WARN_PARSE_CODE YAML_LOAD_WARN_CODE_DEPARSE YAML_LOAD_WARN_BAD_GLOB_ELEM YAML_PARSE_ERR_ZERO_INDENT);package YAML::Warning;our@ISA='YAML::Error';1; - YAML_PARSE_ERR_BAD_CHARS - Invalid characters in stream. This parser only supports printable ASCII - YAML_PARSE_ERR_BAD_MAJOR_VERSION - Can't parse a %s document with a 1.0 parser - YAML_PARSE_WARN_BAD_MINOR_VERSION - Parsing a %s document with a 1.0 parser - YAML_PARSE_WARN_MULTIPLE_DIRECTIVES - '%s directive used more than once' - YAML_PARSE_ERR_TEXT_AFTER_INDICATOR - No text allowed after indicator - YAML_PARSE_ERR_NO_ANCHOR - No anchor for alias '*%s' - YAML_PARSE_ERR_NO_SEPARATOR - Expected separator '---' - YAML_PARSE_ERR_SINGLE_LINE - Couldn't parse single line value - YAML_PARSE_ERR_BAD_ANCHOR - Invalid anchor - YAML_DUMP_ERR_INVALID_INDENT - Invalid Indent width specified: '%s' - YAML_LOAD_USAGE - usage: YAML::Load($yaml_stream_scalar) - YAML_PARSE_ERR_BAD_NODE - Can't parse node - YAML_PARSE_ERR_BAD_EXPLICIT - Unsupported explicit transfer: '%s' - YAML_DUMP_USAGE_DUMPCODE - Invalid value for DumpCode: '%s' - YAML_LOAD_ERR_FILE_INPUT - Couldn't open %s for input:\n%s - YAML_DUMP_ERR_FILE_CONCATENATE - Can't concatenate to YAML file %s - YAML_DUMP_ERR_FILE_OUTPUT - Couldn't open %s for output:\n%s - YAML_DUMP_ERR_FILE_OUTPUT_CLOSE - Error closing %s:\n%s - YAML_DUMP_ERR_NO_HEADER - With UseHeader=0, the node must be a plain hash or array - YAML_DUMP_WARN_BAD_NODE_TYPE - Can't perform serialization for node type: '%s' - YAML_EMIT_WARN_KEYS - Encountered a problem with 'keys':\n%s - YAML_DUMP_WARN_DEPARSE_FAILED - Deparse failed for CODE reference - YAML_DUMP_WARN_CODE_DUMMY - Emitting dummy subroutine for CODE reference - YAML_PARSE_ERR_MANY_EXPLICIT - More than one explicit transfer - YAML_PARSE_ERR_MANY_IMPLICIT - More than one implicit request - YAML_PARSE_ERR_MANY_ANCHOR - More than one anchor - YAML_PARSE_ERR_ANCHOR_ALIAS - Can't define both an anchor and an alias - YAML_PARSE_ERR_BAD_ALIAS - Invalid alias - YAML_PARSE_ERR_MANY_ALIAS - More than one alias - YAML_LOAD_ERR_NO_CONVERT - Can't convert implicit '%s' node to explicit '%s' node - YAML_LOAD_ERR_NO_DEFAULT_VALUE - No default value for '%s' explicit transfer - YAML_LOAD_ERR_NON_EMPTY_STRING - Only the empty string can be converted to a '%s' - YAML_LOAD_ERR_BAD_MAP_TO_SEQ - Can't transfer map as sequence. Non numeric key '%s' encountered. - YAML_DUMP_ERR_BAD_GLOB - '%s' is an invalid value for Perl glob - YAML_DUMP_ERR_BAD_REGEXP - '%s' is an invalid value for Perl Regexp - YAML_LOAD_ERR_BAD_MAP_ELEMENT - Invalid element in map - YAML_LOAD_WARN_DUPLICATE_KEY - Duplicate map key '%s' found. Ignoring. - YAML_LOAD_ERR_BAD_SEQ_ELEMENT - Invalid element in sequence - YAML_PARSE_ERR_INLINE_MAP - Can't parse inline map - YAML_PARSE_ERR_INLINE_SEQUENCE - Can't parse inline sequence - YAML_PARSE_ERR_BAD_DOUBLE - Can't parse double quoted string - YAML_PARSE_ERR_BAD_SINGLE - Can't parse single quoted string - YAML_PARSE_ERR_BAD_INLINE_IMPLICIT - Can't parse inline implicit value '%s' - YAML_PARSE_ERR_BAD_IMPLICIT - Unrecognized implicit value '%s' - YAML_PARSE_ERR_INDENTATION - Error. Invalid indentation level - YAML_PARSE_ERR_INCONSISTENT_INDENTATION - Inconsistent indentation level - YAML_LOAD_WARN_UNRESOLVED_ALIAS - Can't resolve alias *%s - YAML_LOAD_WARN_NO_REGEXP_IN_REGEXP - No 'REGEXP' element for Perl regexp - YAML_LOAD_WARN_BAD_REGEXP_ELEM - Unknown element '%s' in Perl regexp - YAML_LOAD_WARN_GLOB_NAME - No 'NAME' element for Perl glob - YAML_LOAD_WARN_PARSE_CODE - Couldn't parse Perl code scalar: %s - YAML_LOAD_WARN_CODE_DEPARSE - Won't parse Perl code unless $YAML::LoadCode is set - YAML_EMIT_ERR_BAD_LEVEL - Internal Error: Bad level detected - YAML_PARSE_WARN_AMBIGUOUS_TAB - Amibiguous tab converted to spaces - YAML_LOAD_WARN_BAD_GLOB_ELEM - Unknown element '%s' in Perl glob - YAML_PARSE_ERR_ZERO_INDENT - Can't use zero as an indentation width - YAML_LOAD_WARN_GLOB_IO - Can't load an IO filehandle. Yet!!! - ... -YAML_ERROR - -$fatpacked{"YAML/Loader.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_LOADER'; - package YAML::Loader;use YAML::Mo;extends 'YAML::Loader::Base';use YAML::Loader::Base;use YAML::Types;use YAML::Node;use constant LEAF=>1;use constant COLLECTION=>2;use constant VALUE=>"\x07YAML\x07VALUE\x07";use constant COMMENT=>"\x07YAML\x07COMMENT\x07";my$ESCAPE_CHAR='[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f]';my$FOLD_CHAR='>';my$LIT_CHAR='|';my$LIT_CHAR_RX="\\$LIT_CHAR";sub load {my$self=shift;$self->stream($_[0]|| '');return$self->_parse()}sub _parse {my$self=shift;my (%directives,$preface);$self->{stream}=~ s|\015\012|\012|g;$self->{stream}=~ s|\015|\012|g;$self->line(0);$self->die('YAML_PARSE_ERR_BAD_CHARS')if$self->stream =~ /$ESCAPE_CHAR/;$self->{stream}=~ s/(.)\n\Z/$1/s;$self->lines([split /\x0a/,$self->stream,-1]);$self->line(1);$self->_parse_throwaway_comments();$self->document(0);$self->documents([]);$self->zero_indent([]);if (not $self->eos){if ($self->lines->[0]!~ /^---(\s|$)/){unshift @{$self->lines},'---';$self->{line}--}}while (not $self->eos){$self->anchor2node({});$self->{document}++;$self->done(0);$self->level(0);$self->offset->[0]=-1;if ($self->lines->[0]=~ /^---\s*(.*)$/){my@words=split /\s/,$1;%directives=();while (@words){if ($words[0]=~ /^#(\w+):(\S.*)$/){my ($key,$value)=($1,$2);shift(@words);if (defined$directives{$key}){$self->warn('YAML_PARSE_WARN_MULTIPLE_DIRECTIVES',$key,$self->document);next}$directives{$key}=$value}elsif ($words[0]eq ''){shift@words}else {last}}$self->preface(join ' ',@words)}else {$self->die('YAML_PARSE_ERR_NO_SEPARATOR')}if (not $self->done){$self->_parse_next_line(COLLECTION)}if ($self->done){$self->{indent}=-1;$self->content('')}$directives{YAML}||= '1.0';$directives{TAB}||= 'NONE';($self->{major_version},$self->{minor_version})=split /\./,$directives{YAML},2;$self->die('YAML_PARSE_ERR_BAD_MAJOR_VERSION',$directives{YAML})if$self->major_version ne '1';$self->warn('YAML_PARSE_WARN_BAD_MINOR_VERSION',$directives{YAML})if$self->minor_version ne '0';$self->die('Unrecognized TAB policy')unless$directives{TAB}=~ /^(NONE|\d+)(:HARD)?$/;push @{$self->documents},$self->_parse_node()}return wantarray ? @{$self->documents}: $self->documents->[-1]}sub _parse_node {my$self=shift;my$preface=$self->preface;$self->preface('');my ($node,$type,$indicator,$chomp,$parsed_inline)=('')x 5;my ($anchor,$alias,$explicit,$implicit)=('')x 4;($anchor,$alias,$explicit,$implicit,$preface)=$self->_parse_qualifiers($preface);if ($anchor){$self->anchor2node->{$anchor}=CORE::bless [],'YAML-anchor2node'}$self->inline('');while (length$preface){if ($preface =~ s/^($FOLD_CHAR|$LIT_CHAR_RX)//){$indicator=$1;if ($preface =~ s/^([+-])[0-9]*//){$chomp=$1}elsif ($preface =~ s/^[0-9]+([+-]?)//){$chomp=$1}if ($preface =~ s/^(?:\s+#.*$|\s*)$//){}else {$self->die('YAML_PARSE_ERR_TEXT_AFTER_INDICATOR')}}else {$self->inline($preface);$preface=''}}if ($alias){$self->die('YAML_PARSE_ERR_NO_ANCHOR',$alias)unless defined$self->anchor2node->{$alias};if (ref($self->anchor2node->{$alias})ne 'YAML-anchor2node'){$node=$self->anchor2node->{$alias}}else {$node=do {my$sv="*$alias"};push @{$self->anchor2node->{$alias}},[\$node,$self->line]}}elsif (length$self->inline){$node=$self->_parse_inline(1,$implicit,$explicit);$parsed_inline=1;if (length$self->inline){$self->die('YAML_PARSE_ERR_SINGLE_LINE')}}elsif ($indicator eq $LIT_CHAR){$self->{level}++;$node=$self->_parse_block($chomp);$node=$self->_parse_implicit($node)if$implicit;$self->{level}--}elsif ($indicator eq $FOLD_CHAR){$self->{level}++;$node=$self->_parse_unfold($chomp);$node=$self->_parse_implicit($node)if$implicit;$self->{level}--}else {$self->{level}++;$self->offset->[$self->level]||= 0;if ($self->indent==$self->offset->[$self->level]){if ($self->content =~ /^-( |$)/){$node=$self->_parse_seq($anchor)}elsif ($self->content =~ /(^\?|\:( |$))/){$node=$self->_parse_mapping($anchor)}elsif ($preface =~ /^\s*$/){$node=$self->_parse_implicit('')}else {$self->die('YAML_PARSE_ERR_BAD_NODE')}}else {$node=undef}$self->{level}--}$#{$self->offset}=$self->level;if ($explicit){$node=$self->_parse_explicit($node,$explicit)if!$parsed_inline}if ($anchor){if (ref($self->anchor2node->{$anchor})eq 'YAML-anchor2node'){for my$ref (@{$self->anchor2node->{$anchor}}){${$ref->[0]}=$node;$self->warn('YAML_LOAD_WARN_UNRESOLVED_ALIAS',$anchor,$ref->[1])}}$self->anchor2node->{$anchor}=$node}return$node}sub _parse_qualifiers {my$self=shift;my ($preface)=@_;my ($anchor,$alias,$explicit,$implicit,$token)=('')x 5;$self->inline('');while ($preface =~ /^[&*!]/){if ($preface =~ s/^\!(\S+)\s*//){$self->die('YAML_PARSE_ERR_MANY_EXPLICIT')if$explicit;$explicit=$1}elsif ($preface =~ s/^\!\s*//){$self->die('YAML_PARSE_ERR_MANY_IMPLICIT')if$implicit;$implicit=1}elsif ($preface =~ s/^\&([^ ,:]*)\s*//){$token=$1;$self->die('YAML_PARSE_ERR_BAD_ANCHOR')unless$token =~ /^[a-zA-Z0-9_.\/-]+$/;$self->die('YAML_PARSE_ERR_MANY_ANCHOR')if$anchor;$self->die('YAML_PARSE_ERR_ANCHOR_ALIAS')if$alias;$anchor=$token}elsif ($preface =~ s/^\*([^ ,:]*)\s*//){$token=$1;$self->die('YAML_PARSE_ERR_BAD_ALIAS')unless$token =~ /^[a-zA-Z0-9_.\/-]+$/;$self->die('YAML_PARSE_ERR_MANY_ALIAS')if$alias;$self->die('YAML_PARSE_ERR_ANCHOR_ALIAS')if$anchor;$alias=$token}}return ($anchor,$alias,$explicit,$implicit,$preface)}sub _parse_explicit {my$self=shift;my ($node,$explicit)=@_;my ($type,$class);if ($explicit =~ /^\!?perl\/(hash|array|ref|scalar)(?:\:(\w(\w|\:\:)*)?)?$/){($type,$class)=(($1 || ''),($2 || ''));if ($type eq "ref"){$self->die('YAML_LOAD_ERR_NO_DEFAULT_VALUE','XXX',$explicit)unless exists$node->{VALUE()}and scalar(keys %$node)==1;my$value=$node->{VALUE()};$node=\$value}if ($type eq "scalar" and length($class)and!ref($node)){my$value=$node;$node=\$value}if (length($class)and $YAML::LoadBlessed){CORE::bless($node,$class)}return$node}if ($explicit =~ m{^!?perl/(glob|regexp|code)(?:\:(\w(\w|\:\:)*)?)?$}){($type,$class)=(($1 || ''),($2 || ''));my$type_class="YAML::Type::$type";no strict 'refs';if ($type_class->can('yaml_load')){return$type_class->yaml_load($node,$class,$self)}else {$self->die('YAML_LOAD_ERR_NO_CONVERT','XXX',$explicit)}}elsif ($YAML::TagClass->{$explicit}|| $explicit =~ m{^perl/(\@|\$)?([a-zA-Z](\w|::)+)$}){$class=$YAML::TagClass->{$explicit}|| $2;if ($class->can('yaml_load')){require YAML::Node;return$class->yaml_load(YAML::Node->new($node,$explicit))}elsif ($YAML::LoadBlessed){if (ref$node){return CORE::bless$node,$class}else {return CORE::bless \$node,$class}}else {return$node}}elsif (ref$node){require YAML::Node;return YAML::Node->new($node,$explicit)}else {return$node}}sub _parse_mapping {my$self=shift;my ($anchor)=@_;my$mapping=$self->preserve ? YAML::Node->new({}): {};$self->anchor2node->{$anchor}=$mapping;my$key;while (not $self->done and $self->indent==$self->offset->[$self->level]){if ($self->{content}=~ s/^\?\s*//){$self->preface($self->content);$self->_parse_next_line(COLLECTION);$key=$self->_parse_node();$key="$key"}elsif ($self->{content}=~ s/^\=\s*(?=:)//){$key=VALUE}elsif ($self->{content}=~ s/^\=\s*(?=:)//){$key=COMMENT}else {$self->inline($self->content);$key=$self->_parse_inline();$key="$key";$self->content($self->inline);$self->inline('')}unless ($self->{content}=~ s/^:(?:\s+#.*$|\s*)//){$self->die('YAML_LOAD_ERR_BAD_MAP_ELEMENT')}$self->preface($self->content);my$level=$self->level;my$zero_indent=$self->zero_indent;$zero_indent->[$level ]=0;$self->_parse_next_line(COLLECTION);my$value=$self->_parse_node();$#$zero_indent=$level;if (exists$mapping->{$key}){$self->warn('YAML_LOAD_WARN_DUPLICATE_KEY',$key)}else {$mapping->{$key}=$value}}return$mapping}sub _parse_seq {my$self=shift;my ($anchor)=@_;my$seq=[];$self->anchor2node->{$anchor}=$seq;while (not $self->done and $self->indent==$self->offset->[$self->level]){if ($self->content =~ /^-(?: (.*))?$/){$self->preface(defined($1)? $1 : '')}else {if ($self->zero_indent->[$self->level ]){last}$self->die('YAML_LOAD_ERR_BAD_SEQ_ELEMENT')}my$preface=$self->preface;if ($preface =~ m/^ (\s*) ( - (?: \ .* | $ ) ) /x){$self->indent($self->offset->[$self->level]+ 2 + length($1));$self->content($2);$self->level($self->level + 1);$self->offset->[$self->level]=$self->indent;$self->preface('');push @$seq,$self->_parse_seq('');$self->{level}--;$#{$self->offset}=$self->level}elsif ($preface =~ /^ (\s*) ((') (?:''|[^'])*? ' \s* \: (?:\ |$).*) $/x or $preface =~ /^ (\s*) ((") (?:\\\\|[^"])*? " \s* \: (?:\ |$).*) $/x or $preface =~ /^ (\s*) (\?.*$)/x or $preface =~ /^ (\s*) ([^'"\s:#&!\[\]\{\},*|>].*\:(\ .*|$))/x){$self->indent($self->offset->[$self->level]+ 2 + length($1));$self->content($2);$self->level($self->level + 1);$self->offset->[$self->level]=$self->indent;$self->preface('');push @$seq,$self->_parse_mapping('');$self->{level}--;$#{$self->offset}=$self->level}else {$self->_parse_next_line(COLLECTION);push @$seq,$self->_parse_node()}}return$seq}sub _parse_inline {my$self=shift;my ($top,$top_implicit,$top_explicit)=(@_,'','','');$self->{inline}=~ s/^\s*(.*)\s*$/$1/;my ($node,$anchor,$alias,$explicit,$implicit)=('')x 5;($anchor,$alias,$explicit,$implicit,$self->{inline})=$self->_parse_qualifiers($self->inline);if ($anchor){$self->anchor2node->{$anchor}=CORE::bless [],'YAML-anchor2node'}$implicit ||= $top_implicit;$explicit ||= $top_explicit;($top_implicit,$top_explicit)=('','');if ($alias){$self->die('YAML_PARSE_ERR_NO_ANCHOR',$alias)unless defined$self->anchor2node->{$alias};if (ref($self->anchor2node->{$alias})ne 'YAML-anchor2node'){$node=$self->anchor2node->{$alias}}else {$node=do {my$sv="*$alias"};push @{$self->anchor2node->{$alias}},[\$node,$self->line]}}elsif ($self->inline =~ /^\{/){$node=$self->_parse_inline_mapping($anchor)}elsif ($self->inline =~ /^\[/){$node=$self->_parse_inline_seq($anchor)}elsif ($self->inline =~ /^"/){$node=$self->_parse_inline_double_quoted();$node=$self->_unescape($node);$node=$self->_parse_implicit($node)if$implicit}elsif ($self->inline =~ /^'/){$node=$self->_parse_inline_single_quoted();$node=$self->_parse_implicit($node)if$implicit}else {if ($top){$node=$self->inline;$self->inline('')}else {$node=$self->_parse_inline_simple()}$node=$self->_parse_implicit($node)unless$explicit;if ($self->numify and defined$node and not ref$node and length$node and $node =~ m/\A-?(?:0|[1-9][0-9]*)?(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?\z/){$node += 0}}if ($explicit){$node=$self->_parse_explicit($node,$explicit)}if ($anchor){if (ref($self->anchor2node->{$anchor})eq 'YAML-anchor2node'){for my$ref (@{$self->anchor2node->{$anchor}}){${$ref->[0]}=$node;$self->warn('YAML_LOAD_WARN_UNRESOLVED_ALIAS',$anchor,$ref->[1])}}$self->anchor2node->{$anchor}=$node}return$node}sub _parse_inline_mapping {my$self=shift;my ($anchor)=@_;my$node={};$self->anchor2node->{$anchor}=$node;$self->die('YAML_PARSE_ERR_INLINE_MAP')unless$self->{inline}=~ s/^\{\s*//;while (not $self->{inline}=~ s/^\s*\}(\s+#.*$|\s*)//){my$key=$self->_parse_inline();$self->die('YAML_PARSE_ERR_INLINE_MAP')unless$self->{inline}=~ s/^\: \s*//;my$value=$self->_parse_inline();if (exists$node->{$key}){$self->warn('YAML_LOAD_WARN_DUPLICATE_KEY',$key)}else {$node->{$key}=$value}next if$self->inline =~ /^\s*\}/;$self->die('YAML_PARSE_ERR_INLINE_MAP')unless$self->{inline}=~ s/^\,\s*//}return$node}sub _parse_inline_seq {my$self=shift;my ($anchor)=@_;my$node=[];$self->anchor2node->{$anchor}=$node;$self->die('YAML_PARSE_ERR_INLINE_SEQUENCE')unless$self->{inline}=~ s/^\[\s*//;while (not $self->{inline}=~ s/^\s*\](\s+#.*$|\s*)//){my$value=$self->_parse_inline();push @$node,$value;next if$self->inline =~ /^\s*\]/;$self->die('YAML_PARSE_ERR_INLINE_SEQUENCE')unless$self->{inline}=~ s/^\,\s*//}return$node}sub _parse_inline_double_quoted {my$self=shift;my$inline=$self->inline;if ($inline =~ s/^"//){my$node='';while ($inline =~ s/^(\\.|[^"\\]+)//){my$capture=$1;$capture =~ s/^\\"/"/;$node .= $capture;last unless length$inline}if ($inline =~ s/^"(?:\s+#.*|\s*)//){$self->inline($inline);return$node}}$self->die('YAML_PARSE_ERR_BAD_DOUBLE')}sub _parse_inline_single_quoted {my$self=shift;my$inline=$self->inline;if ($inline =~ s/^'//){my$node='';while ($inline =~ s/^(''|[^']+)//){my$capture=$1;$capture =~ s/^''/'/;$node .= $capture;last unless length$inline}if ($inline =~ s/^'(?:\s+#.*|\s*)//){$self->inline($inline);return$node}}$self->die('YAML_PARSE_ERR_BAD_SINGLE')}sub _parse_inline_simple {my$self=shift;my$value;if ($self->inline =~ /^(|[^!@#%^&*].*?)(?=[\[\]\{\},]|, |: |- |:\s*$|$)/){$value=$1;substr($self->{inline},0,length($1))=''}else {$self->die('YAML_PARSE_ERR_BAD_INLINE_IMPLICIT',$value)}return$value}sub _parse_implicit {my$self=shift;my ($value)=@_;$value =~ s/^#.*$//;$value =~ s/\s+#.*$//;$value =~ s/\s*$//;return$value if$value eq '';return undef if$value =~ /^~$/;return$value unless$value =~ /^[\@\`]/ or $value =~ /^[\-\?]\s/;$self->die('YAML_PARSE_ERR_BAD_IMPLICIT',$value)}sub _parse_unfold {my$self=shift;my ($chomp)=@_;my$node='';my$space=0;while (not $self->done and $self->indent==$self->offset->[$self->level]){$node .= $self->content."\n";$self->_parse_next_line(LEAF)}$node =~ s/^(\S.*)\n(?=\S)/$1 /gm;$node =~ s/^(\S.*)\n(\n+\S)/$1$2/gm;$node =~ s/\n*\Z// unless$chomp eq '+';$node .= "\n" unless$chomp;return$node}sub _parse_block {my$self=shift;my ($chomp)=@_;my$node='';while (not $self->done and $self->indent==$self->offset->[$self->level]){$node .= $self->content ."\n";$self->_parse_next_line(LEAF)}return$node if '+' eq $chomp;$node =~ s/\n*\Z/\n/;$node =~ s/\n\Z// if$chomp eq '-';return$node}sub _parse_throwaway_comments {my$self=shift;while (@{$self->lines}and $self->lines->[0]=~ m{^\s*(\#|$)}){shift @{$self->lines};$self->{line}++}$self->eos($self->{done}=not @{$self->lines})}sub _parse_next_line {my$self=shift;my ($type)=@_;my$level=$self->level;my$offset=$self->offset->[$level];$self->die('YAML_EMIT_ERR_BAD_LEVEL')unless defined$offset;shift @{$self->lines};$self->eos($self->{done}=not @{$self->lines});if ($self->eos){$self->offset->[$level + 1]=$offset + 1;return}$self->{line}++;if ($self->preface =~ qr/(?:^|\s)(?:$FOLD_CHAR|$LIT_CHAR_RX)(?:[+-]([0-9]*)|([0-9]*)[+-]?)(?:\s+#.*|\s*)$/){my$explicit_indent=defined $1 ? $1 : defined $2 ? $2 : '';$self->die('YAML_PARSE_ERR_ZERO_INDENT')if length($explicit_indent)and $explicit_indent==0;$type=LEAF;if (length($explicit_indent)){$self->offset->[$level + 1]=$offset + $explicit_indent}else {while (@{$self->lines}&& ($self->lines->[0]=~ /^\s*#/)){$self->lines->[0]=~ /^( *)/;last unless length($1)<= $offset;shift @{$self->lines};$self->{line}++}$self->eos($self->{done}=not @{$self->lines});return if$self->eos;if ($self->lines->[0]=~ /^( *)\S/ and length($1)> $offset){$self->offset->[$level+1]=length($1)}else {$self->offset->[$level+1]=$offset + 1}}$offset=$self->offset->[++$level]}elsif ($type==COLLECTION and $self->preface =~ /^(\s*(\!\S*|\&\S+))*\s*$/){$self->_parse_throwaway_comments();my$zero_indent=$self->zero_indent;if ($self->eos){$self->offset->[$level+1]=$offset + 1;return}elsif (defined$zero_indent->[$level ]and not $zero_indent->[$level ]and $self->lines->[0]=~ /^( {$offset,})-(?: |$)/){my$new_offset=length($1);$self->offset->[$level+1]=$new_offset;if ($new_offset==$offset){$zero_indent->[$level+1 ]=1}}else {$self->lines->[0]=~ /^( *)\S/ or $self->die('YAML_PARSE_ERR_NONSPACE_INDENTATION');if (length($1)> $offset){$self->offset->[$level+1]=length($1)}else {$self->offset->[$level+1]=$offset + 1}}$offset=$self->offset->[++$level]}if ($type==LEAF){if (@{$self->lines}and $self->lines->[0]=~ m{^( *)(\#)} and length($1)< $offset){if (length($1)< $offset){shift @{$self->lines};$self->{line}++;while (@{$self->lines}and $self->lines->[0]=~ m{^( *)(\#)}){shift @{$self->lines};$self->{line}++}}}$self->eos($self->{done}=not @{$self->lines})}else {$self->_parse_throwaway_comments()}return if$self->eos;if ($self->lines->[0]=~ /^---(\s|$)/){$self->done(1);return}if ($type==LEAF and $self->lines->[0]=~ /^ {$offset}(.*)$/){$self->indent($offset);$self->content($1)}elsif ($self->lines->[0]=~ /^\s*$/){$self->indent($offset);$self->content('')}else {$self->lines->[0]=~ /^( *)(\S.*)$/;while ($self->offset->[$level]> length($1)){$level--}$self->die('YAML_PARSE_ERR_INCONSISTENT_INDENTATION')if$self->offset->[$level]!=length($1);$self->indent(length($1));$self->content($2)}$self->die('YAML_PARSE_ERR_INDENTATION')if$self->indent - $offset > 1}my%unescapes=(0=>"\x00",a=>"\x07",t=>"\x09",n=>"\x0a",'v'=>"\x0b",f=>"\x0c",r=>"\x0d",e=>"\x1b",'\\'=>'\\',);sub _unescape {my$self=shift;my ($node)=@_;$node =~ s/\\([never\\fart0]|x([0-9a-fA-F]{2}))/ - (length($1)>1)?pack("H2",$2):$unescapes{$1}/gex;return$node}1; -YAML_LOADER - -$fatpacked{"YAML/Loader/Base.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_LOADER_BASE'; - package YAML::Loader::Base;use YAML::Mo;has load_code=>default=>sub {0};has preserve=>default=>sub {0};has stream=>default=>sub {''};has document=>default=>sub {0};has line=>default=>sub {0};has documents=>default=>sub {[]};has lines=>default=>sub {[]};has eos=>default=>sub {0};has done=>default=>sub {0};has anchor2node=>default=>sub {{}};has level=>default=>sub {0};has offset=>default=>sub {[]};has preface=>default=>sub {''};has content=>default=>sub {''};has indent=>default=>sub {0};has major_version=>default=>sub {0};has minor_version=>default=>sub {0};has inline=>default=>sub {''};has numify=>default=>sub {0};has zero_indent=>default=>sub {[]};sub set_global_options {my$self=shift;$self->load_code($YAML::LoadCode || $YAML::UseCode)if defined$YAML::LoadCode or defined$YAML::UseCode;$self->preserve($YAML::Preserve)if defined$YAML::Preserve;$self->numify($YAML::Numify)if defined$YAML::Numify}sub load {die 'load() not implemented in this class.'}1; -YAML_LOADER_BASE - -$fatpacked{"YAML/Marshall.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_MARSHALL'; - use strict;use warnings;package YAML::Marshall;use YAML::Node ();sub import {my$class=shift;no strict 'refs';my$package=caller;unless (grep {$_ eq $class}@{$package .'::ISA'}){push @{$package .'::ISA'},$class}my$tag=shift;if ($tag){no warnings 'once';$YAML::TagClass->{$tag}=$package;${$package ."::YamlTag"}=$tag}}sub yaml_dump {my$self=shift;no strict 'refs';my$tag=${ref($self)."::YamlTag"}|| 'perl/' .ref($self);$self->yaml_node($self,$tag)}sub yaml_load {my ($class,$node)=@_;if (my$ynode=$class->yaml_ynode($node)){$node=$ynode->{NODE}}bless$node,$class}sub yaml_node {shift;YAML::Node->new(@_)}sub yaml_ynode {shift;YAML::Node::ynode(@_)}1; -YAML_MARSHALL - -$fatpacked{"YAML/Mo.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_MO'; - package YAML::Mo;no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{my$c=shift;my$s=bless{@_},$c;my%n=%{$c.'::'.':E'};map{$s->{$_}=$n{$_}->()if!exists$s->{$_}}keys%n;$s};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};@_=(default,@_)if!($#_%2);$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};*{$M.'builder::e'}=sub{my($P,$e,$o)=@_;$o->{builder}=sub{my($m,$n,%a)=@_;my$b=$a{builder}or return$m;my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=\&{$P.$b}and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$_[0]->$b:$m->(@_)}}};*{$M.'default::e'}=sub{my($P,$e,$o)=@_;$o->{default}=sub{my($m,$n,%a)=@_;exists$a{default}or return$m;my($d,$r)=$a{default};my$g='HASH'eq($r=ref$d)?sub{+{%$d}}:'ARRAY'eq$r?sub{[@$d]}:'CODE'eq$r?$d:sub{$d};my$i=exists$a{lazy}?$a{lazy}:!${$P.':N'};$i or ${$P.':E'}{$n}=$g and return$m;sub{$#_?$m->(@_):!exists$_[0]{$n}?$_[0]{$n}=$g->(@_):$m->(@_)}}};my$i=\&import;*{$M.import}=sub{(@_==2 and not$_[1])?pop@_:@_==1?push@_,grep!/import/,@f:();goto&$i};@f=qw[builder default import];use strict;use warnings;our$DumperModule='Data::Dumper';my ($_new_error,$_info,$_scalar_info);no strict 'refs';*{$M.'Object::die'}=sub {my$self=shift;my$error=$self->$_new_error(@_);$error->type('Error');Carp::croak($error->format_message)};*{$M.'Object::warn'}=sub {my$self=shift;return unless $^W;my$error=$self->$_new_error(@_);$error->type('Warning');Carp::cluck($error->format_message)};*{$M.'Object::node_info'}=sub {my$self=shift;my$stringify=$_[1]|| 0;my ($class,$type,$id)=ref($_[0])? $stringify ? &$_info("$_[0]"): do {require overload;my@info=&$_info(overload::StrVal($_[0]));if (ref($_[0])eq 'Regexp'){@info[0,1]=(undef,'REGEXP')}@info}: &$_scalar_info($_[0]);($class,$type,$id)=&$_scalar_info("$_[0]")unless$id;return wantarray ? ($class,$type,$id): $id};$_info=sub {return (($_[0])=~ qr{^(?:(.*)\=)?([^=]*)\(([^\(]*)\)$}o)};$_scalar_info=sub {my$id='undef';if (defined $_[0]){\$_[0]=~ /\((\w+)\)$/o or CORE::die();$id="$1-S"}return (undef,undef,$id)};$_new_error=sub {require Carp;my$self=shift;require YAML::Error;my$code=shift || 'unknown error';my$error=YAML::Error->new(code=>$code);$error->line($self->line)if$self->can('line');$error->document($self->document)if$self->can('document');$error->arguments([@_]);return$error};1; -YAML_MO - -$fatpacked{"YAML/Node.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_NODE'; - use strict;use warnings;package YAML::Node;use YAML::Tag;require YAML::Mo;use Exporter;our@ISA=qw(Exporter YAML::Mo::Object);our@EXPORT=qw(ynode);sub ynode {my$self;if (ref($_[0])eq 'HASH'){$self=tied(%{$_[0]})}elsif (ref($_[0])eq 'ARRAY'){$self=tied(@{$_[0]})}elsif (ref(\$_[0])eq 'GLOB'){$self=tied(*{$_[0]})}else {$self=tied($_[0])}return (ref($self)=~ /^yaml_/)? $self : undef}sub new {my ($class,$node,$tag)=@_;my$self;$self->{NODE}=$node;my (undef,$type)=YAML::Mo::Object->node_info($node);$self->{KIND}=(not defined$type)? 'scalar' : ($type eq 'ARRAY')? 'sequence' : ($type eq 'HASH')? 'mapping' : $class->die("Can't create YAML::Node from '$type'");tag($self,($tag || ''));if ($self->{KIND}eq 'scalar'){yaml_scalar->new($self,$_[1]);return \ $_[1]}my$package="yaml_" .$self->{KIND};$package->new($self)}sub node {$_->{NODE}}sub kind {$_->{KIND}}sub tag {my ($self,$value)=@_;if (defined$value){$self->{TAG}=YAML::Tag->new($value);return$self}else {return$self->{TAG}}}sub keys {my ($self,$value)=@_;if (defined$value){$self->{KEYS}=$value;return$self}else {return$self->{KEYS}}}package yaml_scalar;@yaml_scalar::ISA=qw(YAML::Node);sub new {my ($class,$self)=@_;tie $_[2],$class,$self}sub TIESCALAR {my ($class,$self)=@_;bless$self,$class;$self}sub FETCH {my ($self)=@_;$self->{NODE}}sub STORE {my ($self,$value)=@_;$self->{NODE}=$value}package yaml_sequence;@yaml_sequence::ISA=qw(YAML::Node);sub new {my ($class,$self)=@_;my$new;tie @$new,$class,$self;$new}sub TIEARRAY {my ($class,$self)=@_;bless$self,$class}sub FETCHSIZE {my ($self)=@_;scalar @{$self->{NODE}}}sub FETCH {my ($self,$index)=@_;$self->{NODE}[$index]}sub STORE {my ($self,$index,$value)=@_;$self->{NODE}[$index]=$value}sub undone {die "Not implemented yet"}*STORESIZE=*POP=*PUSH=*SHIFT=*UNSHIFT=*SPLICE=*DELETE=*EXISTS=*STORESIZE=*POP=*PUSH=*SHIFT=*UNSHIFT=*SPLICE=*DELETE=*EXISTS=*undone;package yaml_mapping;@yaml_mapping::ISA=qw(YAML::Node);sub new {my ($class,$self)=@_;@{$self->{KEYS}}=sort keys %{$self->{NODE}};my$new;tie %$new,$class,$self;$new}sub TIEHASH {my ($class,$self)=@_;bless$self,$class}sub FETCH {my ($self,$key)=@_;if (exists$self->{NODE}{$key}){return (grep {$_ eq $key}@{$self->{KEYS}})? $self->{NODE}{$key}: undef}return$self->{HASH}{$key}}sub STORE {my ($self,$key,$value)=@_;if (exists$self->{NODE}{$key}){$self->{NODE}{$key}=$value}elsif (exists$self->{HASH}{$key}){$self->{HASH}{$key}=$value}else {if (not grep {$_ eq $key}@{$self->{KEYS}}){push(@{$self->{KEYS}},$key)}$self->{HASH}{$key}=$value}$value}sub DELETE {my ($self,$key)=@_;my$return;if (exists$self->{NODE}{$key}){$return=$self->{NODE}{$key}}elsif (exists$self->{HASH}{$key}){$return=delete$self->{NODE}{$key}}for (my$i=0;$i < @{$self->{KEYS}};$i++){if ($self->{KEYS}[$i]eq $key){splice(@{$self->{KEYS}},$i,1)}}return$return}sub CLEAR {my ($self)=@_;@{$self->{KEYS}}=();%{$self->{HASH}}=()}sub FIRSTKEY {my ($self)=@_;$self->{ITER}=0;$self->{KEYS}[0]}sub NEXTKEY {my ($self)=@_;$self->{KEYS}[++$self->{ITER}]}sub EXISTS {my ($self,$key)=@_;exists$self->{NODE}{$key}}1; -YAML_NODE - -$fatpacked{"YAML/Tag.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_TAG'; - use strict;use warnings;package YAML::Tag;use overload '""'=>sub {${$_[0]}};sub new {my ($class,$self)=@_;bless \$self,$class}sub short {${$_[0]}}sub canonical {${$_[0]}}1; -YAML_TAG - -$fatpacked{"YAML/Types.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'YAML_TYPES'; - package YAML::Types;use YAML::Mo;use YAML::Node;package YAML::Type::blessed;use YAML::Mo;sub yaml_dump {my$self=shift;my ($value)=@_;my ($class,$type)=YAML::Mo::Object->node_info($value);no strict 'refs';my$kind=lc($type).':';my$tag=${$class .'::ClassTag'}|| "!perl/$kind$class";if ($type eq 'REF'){YAML::Node->new({(&YAML::VALUE,${$_[0]})},$tag)}elsif ($type eq 'SCALAR'){$_[1]=$$value;YAML::Node->new($_[1],$tag)}elsif ($type eq 'GLOB'){return YAML::Type::glob->yaml_dump($value,$tag)}else {YAML::Node->new($value,$tag)}}package YAML::Type::undef;sub yaml_dump {my$self=shift}sub yaml_load {my$self=shift}package YAML::Type::glob;sub yaml_dump {my$self=shift;my$tag=pop @_ if 2==@_;$tag='!perl/glob:' unless defined$tag;my$ynode=YAML::Node->new({},$tag);for my$type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)){my$value=*{$_[0]}{$type};$value=$$value if$type eq 'SCALAR';if (defined$value){if ($type eq 'IO'){my@stats=qw(device inode mode links uid gid rdev size atime mtime ctime blksize blocks);undef$value;$value->{stat}=YAML::Node->new({});if ($value->{fileno}=fileno(*{$_[0]})){local $^W;map {$value->{stat}{shift@stats}=$_}stat(*{$_[0]});$value->{tell}=tell(*{$_[0]})}}$ynode->{$type}=$value}}return$ynode}sub yaml_load {my$self=shift;my ($node,$class,$loader)=@_;my ($name,$package);if (defined$node->{NAME}){$name=$node->{NAME};delete$node->{NAME}}else {$loader->warn('YAML_LOAD_WARN_GLOB_NAME');return undef}if (defined$node->{PACKAGE}){$package=$node->{PACKAGE};delete$node->{PACKAGE}}else {$package='main'}no strict 'refs';if (exists$node->{SCALAR}){if ($YAML::LoadBlessed and $loader->load_code){*{"${package}::$name"}=\$node->{SCALAR}}delete$node->{SCALAR}}for my$elem (qw(ARRAY HASH CODE IO)){if (exists$node->{$elem}){if ($elem eq 'IO'){$loader->warn('YAML_LOAD_WARN_GLOB_IO');delete$node->{IO};next}if ($YAML::LoadBlessed and $loader->load_code){*{"${package}::$name"}=$node->{$elem}}delete$node->{$elem}}}for my$elem (sort keys %$node){$loader->warn('YAML_LOAD_WARN_BAD_GLOB_ELEM',$elem)}return *{"${package}::$name"}}package YAML::Type::code;my$dummy_warned=0;my$default='{ "DUMMY" }';sub yaml_dump {my$self=shift;my$code;my ($dumpflag,$value)=@_;my ($class,$type)=YAML::Mo::Object->node_info($value);my$tag="!perl/code";$tag .= ":$class" if defined$class;if (not $dumpflag){$code=$default}else {bless$value,"CODE" if$class;eval {require B::Deparse};return if $@;my$deparse=B::Deparse->new();eval {local $^W=0;$code=$deparse->coderef2text($value)};if ($@){warn YAML::YAML_DUMP_WARN_DEPARSE_FAILED()if $^W;$code=$default}bless$value,$class if$class;chomp$code;$code .= "\n"}$_[2]=$code;YAML::Node->new($_[2],$tag)}sub yaml_load {my$self=shift;my ($node,$class,$loader)=@_;if ($loader->load_code){my$code=eval "package main; sub $node";if ($@){$loader->warn('YAML_LOAD_WARN_PARSE_CODE',$@);return sub {}}else {CORE::bless$code,$class if ($class and $YAML::LoadBlessed);return$code}}else {return CORE::bless sub {},$class if ($class and $YAML::LoadBlessed);return sub {}}}package YAML::Type::ref;sub yaml_dump {my$self=shift;YAML::Node->new({(&YAML::VALUE,${$_[0]})},'!perl/ref')}sub yaml_load {my$self=shift;my ($node,$class,$loader)=@_;$loader->die('YAML_LOAD_ERR_NO_DEFAULT_VALUE','ptr')unless exists$node->{&YAML::VALUE};return \$node->{&YAML::VALUE}}package YAML::Type::regexp;sub yaml_dump {die "YAML::Type::regexp::yaml_dump not currently implemented"}use constant _QR_TYPES=>{''=>sub {qr{$_[0]}},x=>sub {qr{$_[0]}x},i=>sub {qr{$_[0]}i},s=>sub {qr{$_[0]}s},m=>sub {qr{$_[0]}m},ix=>sub {qr{$_[0]}ix},sx=>sub {qr{$_[0]}sx},mx=>sub {qr{$_[0]}mx},si=>sub {qr{$_[0]}si},mi=>sub {qr{$_[0]}mi},ms=>sub {qr{$_[0]}sm},six=>sub {qr{$_[0]}six},mix=>sub {qr{$_[0]}mix},msx=>sub {qr{$_[0]}msx},msi=>sub {qr{$_[0]}msi},msix=>sub {qr{$_[0]}msix},};sub yaml_load {my$self=shift;my ($node,$class)=@_;return qr{$node} unless$node =~ /^\(\?([\^\-uxism]*):(.*)\)\z/s;my ($flags,$re)=($1,$2);$flags =~ s/-.*//;$flags =~ s/^\^//;$flags =~ tr/u//d;my$sub=_QR_TYPES->{$flags}|| sub {qr{$_[0]}};my$qr=&$sub($re);bless$qr,$class if (length$class and $YAML::LoadBlessed);return$qr}1; -YAML_TYPES - -$fatpacked{"namespace/clean.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'NAMESPACE_CLEAN'; - package namespace::clean;use warnings;use strict;our$VERSION='0.27';$VERSION=eval$VERSION if$VERSION =~ /_/;our$STORAGE_VAR='__NAMESPACE_CLEAN_STORAGE';use B::Hooks::EndOfScope 'on_scope_end';BEGIN {my$provider;if ("$]" < 5.008007){require Package::Stash::PP;$provider='Package::Stash::PP'}else {require Package::Stash;$provider='Package::Stash'}eval <<"EOS" or die $@}use namespace::clean::_Util qw(DEBUGGER_NEEDS_CV_RENAME DEBUGGER_NEEDS_CV_PIVOT);my$RemoveSubs=sub {my$cleanee=shift;my$store=shift;my$cleanee_stash=stash_for($cleanee);my$deleted_stash;SYMBOL: for my$f (@_){next SYMBOL if$store->{exclude}{$f };my$sub=$cleanee_stash->get_symbol("&$f")or next SYMBOL;my$need_debugger_fixup=(DEBUGGER_NEEDS_CV_RENAME or DEBUGGER_NEEDS_CV_PIVOT)&& $^P & 0x01 && defined&DB::sub && ref(my$globref=\$cleanee_stash->namespace->{$f})eq 'GLOB' && ($deleted_stash ||= stash_for("namespace::clean::deleted::$cleanee"));if (DEBUGGER_NEEDS_CV_RENAME and $need_debugger_fixup){namespace::clean::_Util::get_subname($sub)eq ($cleanee_stash->name ."::$f")and $deleted_stash->add_symbol("&$f",namespace::clean::_Util::set_subname($deleted_stash->name ."::$f",$sub),)}elsif (DEBUGGER_NEEDS_CV_PIVOT and $need_debugger_fixup){$deleted_stash->add_symbol("&$f",$sub)}my@symbols=map {my$name=$_ .$f;my$def=$cleanee_stash->get_symbol($name);defined($def)? [$name,$def]: ()}'$','@','%','';$cleanee_stash->remove_glob($f);DEBUGGER_NEEDS_CV_PIVOT and $need_debugger_fixup and *$globref=$deleted_stash->namespace->{$f};$cleanee_stash->add_symbol(@$_)for@symbols}};sub clean_subroutines {my ($nc,$cleanee,@subs)=@_;$RemoveSubs->($cleanee,{},@subs)}sub import {my ($pragma,@args)=@_;my (%args,$is_explicit);ARG: while (@args){if ($args[0]=~ /^\-/){my$key=shift@args;my$value=shift@args;$args{$key }=$value}else {$is_explicit++;last ARG}}my$cleanee=exists$args{-cleanee }? $args{-cleanee }: scalar caller;if ($is_explicit){on_scope_end {$RemoveSubs->($cleanee,{},@args)}}else {my$functions=$pragma->get_functions($cleanee);my$store=$pragma->get_class_store($cleanee);my$stash=stash_for($cleanee);my%except=map {($_=>1)}($args{-except }? (ref$args{-except }eq 'ARRAY' ? @{$args{-except }}: $args{-except }): ());for my$f (keys %$functions){next if$except{$f };next unless$stash->has_symbol("&$f");$store->{remove}{$f }=1}on_scope_end {$RemoveSubs->($cleanee,$store,keys %{$store->{remove}})};return 1}}sub unimport {my ($pragma,%args)=@_;my$cleanee=exists$args{-cleanee }? $args{-cleanee }: scalar caller;my$functions=$pragma->get_functions($cleanee);my$store=$pragma->get_class_store($cleanee);for my$f (keys %$functions){next if$store->{remove}{$f }or $store->{exclude}{$f };$store->{exclude}{$f }=1}return 1}sub get_class_store {my ($pragma,$class)=@_;my$stash=stash_for($class);my$var="%$STORAGE_VAR";$stash->add_symbol($var,{})unless$stash->has_symbol($var);return$stash->get_symbol($var)}sub get_functions {my ($pragma,$class)=@_;my$stash=stash_for($class);return {map {$_=>$stash->get_symbol("&$_")}$stash->list_all_symbols('CODE')}}'Danger! Laws of Thermodynamics may not apply.' - - sub stash_for (\$) { - $provider->new(\$_[0]); - } - - 1; - - EOS -NAMESPACE_CLEAN - -$fatpacked{"namespace/clean/_Util.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'NAMESPACE_CLEAN__UTIL'; - package namespace::clean::_Util;use warnings;use strict;use base 'Exporter';our@EXPORT_OK=qw(DEBUGGER_NEEDS_CV_RENAME DEBUGGER_NEEDS_CV_PIVOT);use constant DEBUGGER_NEEDS_CV_RENAME=>(("$]" > 5.008_008)and ("$]" < 5.013_006));use constant DEBUGGER_NEEDS_CV_PIVOT=>((!DEBUGGER_NEEDS_CV_RENAME)and ("$]" < 5.015_005));BEGIN {DEBUGGER_NEEDS_CV_RENAME and (eval <<'EOS' or die $@)}1; - { - my( $sub_name_loaded, $sub_util_loaded ); - - sub _namer_load_error { - return '' if $sub_util_loaded or $sub_name_loaded; - - # if S::N is loaded first *and* so is B - then go with that, otherwise - # prefer Sub::Util as S::U will provide a faster get_subname and will - # not need further require() calls - # this is rather arbitrary but remember this code exists only perls - # between 5.8.9 ~ 5.13.5 - - # when changing version also change in Makefile.PL - my $sn_ver = 0.04; - - local $@; - my $err = ''; - - ( - ! ( - $INC{"B.pm"} - and - $INC{"Sub/Name.pm"} - and - eval { Sub::Name->VERSION($sn_ver) } - ) - and - eval { require Sub::Util } - and - # see https://github.com/moose/Moo/commit/dafa5118 - defined &Sub::Util::set_subname - and - $sub_util_loaded = 1 - ) - or - ( - eval { require Sub::Name and Sub::Name->VERSION($sn_ver) } - and - $sub_name_loaded = 1 - ) - or - $err = "When running under -d on this perl $], namespace::clean requires either Sub::Name $sn_ver or Sub::Util to be installed" - ; - - $err; - } - - sub set_subname { - if( my $err = _namer_load_error() ) { - die $err; - } - elsif( $sub_name_loaded ) { - &Sub::Name::subname; - } - elsif( $sub_util_loaded ) { - &Sub::Util::set_subname; - } - else { - die "How the fuck did we get here? Read source and debug please!"; - } - } - - sub get_subname { - if( - _namer_load_error() - or - ! $sub_util_loaded - ) { - require B; - my $gv = B::svref_2object( $_[0] )->GV; - join '::', $gv->STASH->NAME, $gv->NAME; - } - else { - &Sub::Util::subname; - } - } - } - 1; - EOS -NAMESPACE_CLEAN__UTIL - s/^ //mg for values %fatpacked; my $class = 'FatPacked::'.(0+\%fatpacked); @@ -643,7 +393,7 @@ use strict; use GraphQL::Client::CLI; -our $VERSION = '0.603'; # VERSION +our $VERSION = '0.604'; # VERSION GraphQL::Client::CLI->main(@ARGV); @@ -659,14 +409,14 @@ graphql - Command-line GraphQL client =head1 VERSION -version 0.603 +version 0.604 =head1 SYNOPSIS graphql [ [--variables JSON] | [--variable KEY=VALUE]... ] [--operation-name NAME] [--transport KEY=VALUE]... - [--[no-]unpack] [--format json|json:pretty|yaml|perl|csv|tsv|table] - [--output FILE] + [--[no-]unpack] [--filter JSONPATH] + [--format json|json:pretty|yaml|perl|csv|tsv|table] [--output FILE] graphql --version|--help|--manual @@ -776,6 +526,14 @@ practice. Use C<--no-unpack> to disable if unpack mode was enabled via C. +=head2 C<--filter JSONPATH> + +Filter the response based on a L expression. + +Requires L. + +Alias: C<-p> + =head1 FORMAT The argument for L can be one of: