| 1 |
|
| package GraphQL::AsyncIterator; |
| 2 |
|
| |
| 3 |
2 |
▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 4 |
2 |
▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 5 |
2 |
▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 6 |
2 |
▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 7 |
2 |
▶ | use GraphQL::Debug qw(_debug); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 8 |
2 |
▶ | use Types::Standard -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 9 |
2 |
▶ | use Types::TypeTiny -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 10 |
2 |
▶ | use GraphQL::Type::Library -all; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 11 |
2 |
▶ | use GraphQL::PubSub; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 12 |
2 |
▶ | use GraphQL::MaybeTypeCheck; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 13 |
2 |
▶ | use curry; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 14 |
|
| |
| 15 |
2 |
▶ | use constant DEBUG => $ENV{GRAPHQL_DEBUG}; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 16 |
|
| |
| 17 |
|
| =head1 NAME |
| 18 |
|
| |
| 19 |
|
| GraphQL::AsyncIterator - iterator objects that return promise to next result |
| 20 |
|
| |
| 21 |
|
| =head1 SYNOPSIS |
| 22 |
|
| |
| 23 |
|
| use GraphQL::AsyncIterator; |
| 24 |
|
| my $i = GraphQL::AsyncIterator->new( |
| 25 |
|
| promise_code => $pc, |
| 26 |
|
| ); |
| 27 |
|
| # also works when publish happens before next_p called |
| 28 |
|
| my $promised_value = $i->next_p; |
| 29 |
|
| $i->publish('hi'); # now $promised_value will be fulfilled |
| 30 |
|
| |
| 31 |
|
| $i->close_tap; # now next_p will return undef |
| 32 |
|
| |
| 33 |
|
| =head1 DESCRIPTION |
| 34 |
|
| |
| 35 |
|
| Encapsulates the asynchronous event-handling needed for the |
| 36 |
|
| publish/subscribe behaviour needed by L<GraphQL::Subscription>. |
| 37 |
|
| |
| 38 |
|
| =head1 ATTRIBUTES |
| 39 |
|
| |
| 40 |
|
| =head2 promise_code |
| 41 |
|
| |
| 42 |
|
| A hash-ref matching L<GraphQL::Type::Library/PromiseCode>, which must |
| 43 |
|
| provide the C<new> key. |
| 44 |
|
| |
| 45 |
|
| =cut |
| 46 |
|
| |
| 47 |
2 |
| has promise_code => (is => 'ro', isa => PromiseCode); |
| 48 |
|
| |
| 49 |
|
| =head1 METHODS |
| 50 |
|
| |
| 51 |
|
| =head2 publish(@values) |
| 52 |
|
| |
| 53 |
|
| Resolves the relevant promise with C<@values>. |
| 54 |
|
| |
| 55 |
|
| =cut |
| 56 |
|
| |
| 57 |
10 |
▶ | has _values_queue => (is => 'ro', isa => ArrayRef, default => sub { [] }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 58 |
2 |
| has _next_promise => (is => 'rw', isa => Maybe[Promise]); |
| 59 |
|
| |
| 60 |
22 |
▶ | method publish(@values) { |
|
Subroutine
publish: called CC=2 SCAR=7.0
Pod
documented
Branch: 1 branch
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method publish (expected 1, got ' . @_ . ')') |
0 |
22 |
22 |
|
| 61 |
22 |
| $self->_emit('resolve', \@values); |
| 62 |
2 |
| } |
| 63 |
|
| |
| 64 |
38 |
▶ | method _promisify((Enum[qw(resolve reject)]) $method, $data) { |
|
Subroutine
_promisify: called CC=5 SCAR=16.4
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method _promisify (expected 3, got ' . @_ . ')') |
0 |
38 |
38 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method _promisify (expected 3, got ' . @_ . ')') |
0 |
38 |
38 |
| Type::Tiny::XS::AUTO::TC52($method) or Function::Parameters::_croak('In method _promisify: parameter 1 ($method): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1069,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Enum[\"resolve\",\"reject\"]","name" => "__ANON__","uniq" => 221,"unique_values" => ["reject","resolve"],"values" => ["resolve","reject"]}, 'Type::Tiny::Enum' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($method)) |
38 |
0 |
38 |
|
| 65 |
38 |
▶ | return $data if is_Promise($data); |
Branch: 1 branch
| Branch | True | False | Total |
| if is_Promise($data) |
20 |
18 |
38 |
|
| 66 |
18 |
| $self->promise_code->{$method}->(@$data); |
| 67 |
2 |
| } |
| 68 |
|
| |
| 69 |
20 |
▶ | method _thenify(Maybe[CodeLike] $then, Maybe[CodeLike] $catch, (Enum[qw(resolve reject)]) $method, $data) { |
|
Subroutine
_thenify: called CC=8 SCAR=23.1
Branch: 5 branches
| Branch | True | False | Total |
| @_ < 5 and Function::Parameters::_croak('Too few arguments for method _thenify (expected 5, got ' . @_ . ')') |
0 |
20 |
20 |
| @_ > 5 and Function::Parameters::_croak('Too many arguments for method _thenify (expected 5, got ' . @_ . ')') |
0 |
20 |
20 |
| Type::Tiny::XS::AUTO::TC8($then) or Function::Parameters::_croak('In method _thenify: parameter 1 ($then): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; my $value = shift(); return !0 unless defined $value; return $param->check($value);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/x86_64-linux/Function/Parameters.pm","line" => 98,"package" => "Function::Parameters"},"deprecated" => !!0,"display_name" => "Maybe[CodeLike]","inlined" => sub { package Types::Standard; no warnings; use strict; my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check";},"name" => "__ANON__","parameters" => [bless( {"_default_message" => sub { package Type::Tiny; use warnings; use strict; sprintf '%s did not pass type constraint "%s"', _dd($_[0]), $name;},"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"compiled_type_constraint" => sub ;,"constraint" => sub { package Types::TypeTiny; use warnings; use strict; ref $_ eq 'CODE' or builtin::blessed($_) and _check_overload($_, '&{}');},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/TypeTiny.pm","line" => 432,"package" => "Types::TypeTiny"},"deprecated" => !!0,"display_name" => "CodeLike","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::TypeTiny; use warnings; use strict; $Type::Tiny::AvoidCallbacks || !$xsubname ? goto $inlined : "$xsubname($_[1])";},"is_using_default_message" => 1,"library" => "Types::TypeTiny","name" => "CodeLike","type_default" => sub { package Types::TypeTiny; use warnings; use strict; return sub { } ;},"uniq" => 94}, 'Type::Tiny' )],"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Maybe","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; return $param->coercion;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Maybe') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Maybe', \@_, 1); my $param = Types::TypeTiny::to_TypeTiny(shift()); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to Maybe[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my @xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); push @xsub, Type::Tiny::XS::get_coderef_for("Maybe[$paramname]") if $paramname }; return sub { my $value = shift(); return !0 unless defined $value; return $param->check($value); } , @xsub;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return [sprintf('%s is defined', Type::Tiny::_dd($value)), sprintf('"%s" constrains the value with "%s" if it is defined', $type, $param), @{$param->validate_explain($value, $varname);}];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 657,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Maybe","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $param = shift(); my $param_compiled_check = $param->compiled_check; my $xsubname; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsubname = Type::Tiny::XS::get_subname_for("Maybe[$paramname]") }; return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check"; } ;},"library" => "Types::Standard","name" => "Maybe","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; $_[0]->type_default or $Type::Tiny::parameterize_type->type_default;},"uniq" => 25}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 100}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"type_default"} = $v->{"parameters"}[0]{"type_default"}; \$v}->get_message($then)) |
20 |
0 |
20 |
| Type::Tiny::XS::AUTO::TC8($catch) or Function::Parameters::_croak('In method _thenify: parameter 2 ($catch): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; my $value = shift(); return !0 unless defined $value; return $param->check($value);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/x86_64-linux/Function/Parameters.pm","line" => 98,"package" => "Function::Parameters"},"deprecated" => !!0,"display_name" => "Maybe[CodeLike]","inlined" => sub { package Types::Standard; no warnings; use strict; my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check";},"name" => "__ANON__","parameters" => [bless( {"_default_message" => sub { package Type::Tiny; use warnings; use strict; sprintf '%s did not pass type constraint "%s"', _dd($_[0]), $name;},"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"compiled_type_constraint" => sub ;,"constraint" => sub { package Types::TypeTiny; use warnings; use strict; ref $_ eq 'CODE' or builtin::blessed($_) and _check_overload($_, '&{}');},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/TypeTiny.pm","line" => 432,"package" => "Types::TypeTiny"},"deprecated" => !!0,"display_name" => "CodeLike","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::TypeTiny; use warnings; use strict; $Type::Tiny::AvoidCallbacks || !$xsubname ? goto $inlined : "$xsubname($_[1])";},"is_using_default_message" => 1,"library" => "Types::TypeTiny","name" => "CodeLike","type_default" => sub { package Types::TypeTiny; use warnings; use strict; return sub { } ;},"uniq" => 94}, 'Type::Tiny' )],"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Maybe","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; return $param->coercion;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Maybe') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Maybe', \@_, 1); my $param = Types::TypeTiny::to_TypeTiny(shift()); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to Maybe[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my @xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); push @xsub, Type::Tiny::XS::get_coderef_for("Maybe[$paramname]") if $paramname }; return sub { my $value = shift(); return !0 unless defined $value; return $param->check($value); } , @xsub;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return [sprintf('%s is defined', Type::Tiny::_dd($value)), sprintf('"%s" constrains the value with "%s" if it is defined', $type, $param), @{$param->validate_explain($value, $varname);}];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 657,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Maybe","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $param = shift(); my $param_compiled_check = $param->compiled_check; my $xsubname; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsubname = Type::Tiny::XS::get_subname_for("Maybe[$paramname]") }; return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check"; } ;},"library" => "Types::Standard","name" => "Maybe","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; $_[0]->type_default or $Type::Tiny::parameterize_type->type_default;},"uniq" => 25}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 100}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"type_default"} = $v->{"parameters"}[0]{"type_default"}; \$v}->get_message($catch)) |
20 |
0 |
20 |
| Type::Tiny::XS::AUTO::TC52($method) or Function::Parameters::_croak('In method _thenify: parameter 3 ($method): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1069,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Enum[\"resolve\",\"reject\"]","name" => "__ANON__","uniq" => 221,"unique_values" => ["reject","resolve"],"values" => ["resolve","reject"]}, 'Type::Tiny::Enum' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($method)) |
20 |
0 |
20 |
|
| 70 |
20 |
▶ | return $data unless $then or $catch; |
Branch: 1 branch
| Branch | True | False | Total |
| unless $then or $catch |
0 |
20 |
20 |
MC/DC0%0/2
$then or $catch
$then
$catch
|
| 71 |
20 |
| $self->_promisify($method, $data)->then($then, $catch); |
| 72 |
2 |
| } |
| 73 |
|
| |
| 74 |
25 |
▶ | method _emit((Enum[qw(resolve reject)]) $method, $data) { |
|
Subroutine
_emit: called CC=7 SCAR=19.7
Branch: 3 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method _emit (expected 3, got ' . @_ . ')') |
0 |
25 |
25 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method _emit (expected 3, got ' . @_ . ')') |
0 |
25 |
25 |
| Type::Tiny::XS::AUTO::TC52($method) or Function::Parameters::_croak('In method _emit: parameter 1 ($method): ' . ${my $v = bless( {"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 1069,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Enum[\"resolve\",\"reject\"]","name" => "__ANON__","uniq" => 221,"unique_values" => ["reject","resolve"],"values" => ["resolve","reject"]}, 'Type::Tiny::Enum' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"}; \$v}->get_message($method)) |
25 |
0 |
25 |
|
| 75 |
25 |
▶ | if ($self->_exhausted) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($self->_exhausted) |
1 |
24 |
25 |
|
| 76 |
1 |
| die "Tried to emit to closed-off AsyncIterator\n"; |
| 77 |
|
| } |
| 78 |
24 |
▶ | if (my $next_promise = $self->_next_promise) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (my $next_promise = $self->_next_promise) { } |
6 |
18 |
24 |
|
| 79 |
6 |
▶ | $next_promise->$method(ref $data eq 'ARRAY' ? @$data : $data); |
Branch: 1 branch
| Branch | True | False | Total |
| ref $data eq 'ARRAY' ? : |
6 |
0 |
6 |
|
| 80 |
6 |
| $self->_next_promise(undef); |
| 81 |
|
| } else { |
| 82 |
18 |
| push @{$self->_values_queue}, { data => $data, method => $method }; |
| 83 |
|
| } |
| 84 |
2 |
| } |
| 85 |
|
| |
| 86 |
|
| =head2 error(@values) |
| 87 |
|
| |
| 88 |
|
| Rejects the relevant promise with C<@values>. |
| 89 |
|
| |
| 90 |
|
| =cut |
| 91 |
|
| |
| 92 |
3 |
▶ | method error(@values) { |
|
Subroutine
error: called CC=2 SCAR=7.0
Pod
documented
Branch: 1 branch
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method error (expected 1, got ' . @_ . ')') |
0 |
3 |
3 |
|
| 93 |
3 |
| $self->_emit('reject', \@values); |
| 94 |
2 |
| } |
| 95 |
|
| |
| 96 |
|
| =head2 next_p |
| 97 |
|
| |
| 98 |
|
| Returns either a L<GraphQL::Type::Library/Promise> of the next value, |
| 99 |
|
| or C<undef> when closed off. Do not call this if a previous promised next |
| 100 |
|
| value has not been settled, as a queue is not maintained. |
| 101 |
|
| |
| 102 |
|
| The promise will have each of the sets of handlers added by L</map_then> |
| 103 |
|
| appended. |
| 104 |
|
| |
| 105 |
|
| =cut |
| 106 |
|
| |
| 107 |
27 |
▶ | method next_p() :ReturnType(Maybe[Promise]) { |
|
Subroutine
next_p: called CC=7 SCAR=19.5
Pod
documented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method next_p (expected 1, got ' . @_ . ')') |
0 |
27 |
27 |
| @_ > 1 and Function::Parameters::_croak('Too many arguments for method next_p (expected 1, got ' . @_ . ')') |
0 |
27 |
27 |
|
| 108 |
27 |
▶ | return undef if $self->_exhausted and !@{$self->_values_queue}; |
Branch: 1 branch
| Branch | True | False | Total |
| if $self->_exhausted and not @{$self->_values_queue;} |
3 |
24 |
27 |
Condition100%3/3
$self->_exhausted and not @{$self->_values_queue;}
MC/DC100%2/2
$self->_exhausted and not @{$self->_values_queue;}
$self->_exhausted
not @{$self->_values_queue;}
Truth table100%3/3
A and not(B)
A= $self->_exhaustedB= not @{$self->_values_queue;}
|
| 109 |
24 |
| my $np; |
| 110 |
24 |
▶ | if (my $value = shift @{$self->_values_queue}) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (my $value = shift @{$self->_values_queue;}) { } |
18 |
6 |
24 |
|
| 111 |
18 |
| $np = $self->_promisify(@$value{qw(method data)}); |
| 112 |
|
| } else { |
| 113 |
6 |
| $np = $self->_next_promise($self->promise_code->{new}->()); |
| 114 |
|
| } |
| 115 |
24 |
| $np = $self->_thenify(@$_, 'resolve', $np) for @{$self->_handler_frames}; |
| 116 |
24 |
| $np; |
| 117 |
2 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 118 |
|
| |
| 119 |
|
| =head2 close_tap |
| 120 |
|
| |
| 121 |
|
| Switch to being closed off. L</next_p> will return C<undef> as soon as |
| 122 |
|
| it runs out of L</publish>ed values. L</publish> will throw an exception. |
| 123 |
|
| B<NB> This will not cause the settling of any outstanding promise returned |
| 124 |
|
| by L</next_p>. |
| 125 |
|
| |
| 126 |
|
| =cut |
| 127 |
|
| |
| 128 |
10 |
▶ | has _exhausted => (is => 'rw', isa => Bool, default => sub { 0 }); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 129 |
|
| |
| 130 |
3 |
▶ | method close_tap() :ReturnType(Maybe[Promise]) { |
|
Subroutine
close_tap: called CC=4 SCAR=14.5
Pod
documented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method close_tap (expected 1, got ' . @_ . ')') |
0 |
3 |
3 |
| @_ > 1 and Function::Parameters::_croak('Too many arguments for method close_tap (expected 1, got ' . @_ . ')') |
0 |
3 |
3 |
|
| 131 |
3 |
▶ | return if $self->_exhausted; # already done - no need to redo |
Branch: 1 branch
| Branch | True | False | Total |
| if $self->_exhausted |
0 |
3 |
3 |
|
| 132 |
3 |
| $self->_exhausted(1); |
| 133 |
2 |
▶ | } |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 134 |
|
| |
| 135 |
|
| =head2 map_then($then, $catch) |
| 136 |
|
| |
| 137 |
|
| Adds the handlers to this object's list of handlers, which will be |
| 138 |
|
| attached to promises returned by L</next_p>. Returns self. |
| 139 |
|
| |
| 140 |
|
| =cut |
| 141 |
|
| |
| 142 |
|
| has _handler_frames => ( |
| 143 |
10 |
▶ | is => 'ro', isa => ArrayRef[ArrayRef[CodeLike]], default => sub {[]}, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 144 |
2 |
| ); |
| 145 |
|
| |
| 146 |
11 |
▶ | method map_then(Maybe[CodeLike] $then, Maybe[CodeLike] $catch = undef) { |
|
Subroutine
map_then: called CC=5 SCAR=16.6
Pod
documented
Branch: 4 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method map_then (expected 2, got ' . @_ . ')') |
0 |
11 |
11 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method map_then (expected 3, got ' . @_ . ')') |
0 |
11 |
11 |
| Type::Tiny::XS::AUTO::TC8($then) or Function::Parameters::_croak('In method map_then: parameter 1 ($then): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; my $value = shift(); return !0 unless defined $value; return $param->check($value);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/x86_64-linux/Function/Parameters.pm","line" => 98,"package" => "Function::Parameters"},"deprecated" => !!0,"display_name" => "Maybe[CodeLike]","inlined" => sub { package Types::Standard; no warnings; use strict; my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check";},"name" => "__ANON__","parameters" => [bless( {"_default_message" => sub { package Type::Tiny; use warnings; use strict; sprintf '%s did not pass type constraint "%s"', _dd($_[0]), $name;},"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"compiled_type_constraint" => sub ;,"constraint" => sub { package Types::TypeTiny; use warnings; use strict; ref $_ eq 'CODE' or builtin::blessed($_) and _check_overload($_, '&{}');},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/TypeTiny.pm","line" => 432,"package" => "Types::TypeTiny"},"deprecated" => !!0,"display_name" => "CodeLike","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::TypeTiny; use warnings; use strict; $Type::Tiny::AvoidCallbacks || !$xsubname ? goto $inlined : "$xsubname($_[1])";},"is_using_default_message" => 1,"library" => "Types::TypeTiny","name" => "CodeLike","type_default" => sub { package Types::TypeTiny; use warnings; use strict; return sub { } ;},"uniq" => 94}, 'Type::Tiny' )],"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Maybe","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; return $param->coercion;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Maybe') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Maybe', \@_, 1); my $param = Types::TypeTiny::to_TypeTiny(shift()); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to Maybe[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my @xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); push @xsub, Type::Tiny::XS::get_coderef_for("Maybe[$paramname]") if $paramname }; return sub { my $value = shift(); return !0 unless defined $value; return $param->check($value); } , @xsub;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return [sprintf('%s is defined', Type::Tiny::_dd($value)), sprintf('"%s" constrains the value with "%s" if it is defined', $type, $param), @{$param->validate_explain($value, $varname);}];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 657,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Maybe","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $param = shift(); my $param_compiled_check = $param->compiled_check; my $xsubname; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsubname = Type::Tiny::XS::get_subname_for("Maybe[$paramname]") }; return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check"; } ;},"library" => "Types::Standard","name" => "Maybe","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; $_[0]->type_default or $Type::Tiny::parameterize_type->type_default;},"uniq" => 25}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 100}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"type_default"} = $v->{"parameters"}[0]{"type_default"}; \$v}->get_message($then)) |
11 |
0 |
11 |
| Type::Tiny::XS::AUTO::TC8($catch) or Function::Parameters::_croak('In method map_then: parameter 2 ($catch): ' . ${my $v = bless( {"_build_coercion" => sub { package Type::Tiny; use warnings; use strict; my $coercion = shift(); my $built = $self->coercion_generator->($self, $P, @args); $coercion->add_type_coercions(@{$built->type_coercion_map;}) if $built; $coercion->freeze;},"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Types::Standard; no warnings; use strict; my $value = shift(); return !0 unless defined $value; return $param->check($value);},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/x86_64-linux/Function/Parameters.pm","line" => 98,"package" => "Function::Parameters"},"deprecated" => !!0,"display_name" => "Maybe[CodeLike]","inlined" => sub { package Types::Standard; no warnings; use strict; my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check";},"name" => "__ANON__","parameters" => [bless( {"_default_message" => sub { package Type::Tiny; use warnings; use strict; sprintf '%s did not pass type constraint "%s"', _dd($_[0]), $name;},"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"compiled_type_constraint" => sub ;,"constraint" => sub { package Types::TypeTiny; use warnings; use strict; ref $_ eq 'CODE' or builtin::blessed($_) and _check_overload($_, '&{}');},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/TypeTiny.pm","line" => 432,"package" => "Types::TypeTiny"},"deprecated" => !!0,"display_name" => "CodeLike","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::TypeTiny; use warnings; use strict; $Type::Tiny::AvoidCallbacks || !$xsubname ? goto $inlined : "$xsubname($_[1])";},"is_using_default_message" => 1,"library" => "Types::TypeTiny","name" => "CodeLike","type_default" => sub { package Types::TypeTiny; use warnings; use strict; return sub { } ;},"uniq" => 94}, 'Type::Tiny' )],"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Maybe","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"coercion_generator" => sub { package Types::Standard; no warnings; use strict; my($parent, $child, $param) = @_; return unless $param->has_coercion; return $param->coercion;},"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"constraint_generator" => sub { package Types::Standard; no warnings; use strict; return $meta->get_type('Maybe') unless @_; Type::Tiny::check_parameter_count_for_parameterized_type('Types::Standard', 'Maybe', \@_, 1); my $param = Types::TypeTiny::to_TypeTiny(shift()); Types::TypeTiny::is_TypeTiny($param) or _croak "Parameter to Maybe[`a] expected to be a type constraint; got $param"; my $param_compiled_check = $param->compiled_check; my @xsub; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); push @xsub, Type::Tiny::XS::get_coderef_for("Maybe[$paramname]") if $paramname }; return sub { my $value = shift(); return !0 unless defined $value; return $param->check($value); } , @xsub;},"deep_explanation" => sub { package Types::Standard; no warnings; use strict; my($type, $value, $varname) = @_; my $param = $type->parameters->[0]; return [sprintf('%s is defined', Type::Tiny::_dd($value)), sprintf('"%s" constrains the value with "%s" if it is defined', $type, $param), @{$param->validate_explain($value, $varname);}];},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 657,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Maybe","exception_class" => "Error::TypeTiny::Assertion","inline_generator" => sub { package Types::Standard; no warnings; use strict; my $param = shift(); my $param_compiled_check = $param->compiled_check; my $xsubname; do { my $paramname = Type::Tiny::XS::is_known($param_compiled_check); $xsubname = Type::Tiny::XS::get_subname_for("Maybe[$paramname]") }; return unless $param->can_be_inlined; return sub { my $v = $_[1]; return "$xsubname($v)" if $xsubname and not $Type::Tiny::AvoidCallbacks; my $param_check = $param->inline_check($v); "!defined($v) or $param_check"; } ;},"library" => "Types::Standard","name" => "Maybe","name_generator" => sub { package Type::Tiny; use warnings; use strict; defined $_ and s/[\x00-\x1F]//gms foreach (my($s, @a) = @_); sprintf '%s[%s]', $s, join(',', map((!defined($_) ? 'undef' : (!ref($_) && /\W/ ? B::perlstring($_) : $_)), @a));},"parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Sub::Defer; use warnings; use strict; $undeferred ||= undefer_sub($deferred_info->[4]); goto \&$undeferred;},"_overload_coderef_no_rebuild" => 1,"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"type_default_generator" => sub { package Types::Standard; no warnings; use strict; $_[0]->type_default or $Type::Tiny::parameterize_type->type_default;},"uniq" => 25}, 'Type::Tiny' ),"type_default" => do{my $o},"uniq" => 100}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"};$v->{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"};$v->{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"parent"}{"parent"}{"parent"};$v->{"parent"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"parent"}{"parent"}{"parent"}{"constraint"} = $v->{"parent"}{"constraint"};$v->{"type_default"} = $v->{"parameters"}[0]{"type_default"}; \$v}->get_message($catch)) |
11 |
0 |
11 |
|
| 147 |
11 |
| push @{$self->_handler_frames}, [ $then, $catch ]; |
| 148 |
11 |
| $self; |
| 149 |
2 |
| } |
| 150 |
|
| |
| 151 |
2 |
| __PACKAGE__->meta->make_immutable(); |
| 152 |
|
| |
| 153 |
2 |
| 1; |