| 1 | package Iterator::Flex::Base; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Iterator object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 55 | ▶ | use v5.28; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 55 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 55 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 55 | ▶ | use experimental qw( signatures postderef declared_refs ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 55 | our $VERSION = '0.34'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 55 | ▶ | use Ref::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 55 | ▶ | use Scalar::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 55 | ▶ | use List::Util; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 55 | ▶ | use Role::Tiny (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 55 | ▶ | use Role::Tiny::With (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 55 | ▶ | use Module::Runtime (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 55 | ▶ | use Iterator::Flex::Utils qw ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | :default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | :ExhaustionActions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | :GeneralParameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | :RegistryIndices | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | :IterAttrs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | :IterStates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | :InterfaceParameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | :SignalParameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | load_role | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | throw_failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 55 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 55 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 180 | ▶ | '<>' => sub ( $self, $, $ ) { &{$self}() }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | fallback => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | bool => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # these are required for the perldb to not barf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # see https://github.com/Perl/perl5/issues/23486 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | eq => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | q{""} => sub { q{} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 55 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # We separate constructor parameters into two categories: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # 1. those that are used to construct the iterator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # 2. those that specify what happens when the iterator signals exhaustion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # Category #2 may be expanded. Category #2 parameters are *not* passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # to the iterator class construct* routines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 294 | ▶ | sub new ( $class, $state = undef, $general = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 294 | return $class->new_from_state( $state, $general ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 315 | ▶ | sub new_from_state ( $class, $state, $general ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_from_state: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 315 | return $class->new_from_attrs( $class->construct( $state ), $general ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 407 | ▶ | sub new_from_attrs ( $class, $in_ipar = {}, $in_gpar = {} ) { ## no critic (ExcessComplexity) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_from_attrs: called CC=30 SCAR=35.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 407 | my %ipar = $in_ipar->%*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 407 | my %gpar = $in_gpar->%*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 407 | $class->_validate_interface_pars( \%ipar ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 407 | $class->_validate_signal_pars( \%gpar ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 407 | ▶ | my @roles = ( delete( $ipar{ +_ROLES } ) // [] )->@*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $ipar{"_roles"} // []
MC/DC100%1/1
delete $ipar{"_roles"} // []
delete $ipar{"_roles"}
Truth table100%2/2
A
A= delete $ipar{"_roles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 407 | ▶ | $gpar{ +ERROR } //= [THROW]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$gpar{"error"} //= ["throw"]
MC/DC100%1/1
$gpar{"error"} //= ["throw"]
$gpar{"error"}
Truth table100%2/2
A
A= $gpar{"error"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | $gpar{ +ERROR } = [ $gpar{ +ERROR } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 407 | ▶ | unless Ref::Util::is_arrayref( $gpar{ +ERROR } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 407 | ▶ | if ( $gpar{ +ERROR }[0] eq THROW ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 407 | push @roles, 'Error::Throw'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | throw_failure( q{unknown specification of iterator error signaling behavior:}, $gpar{ +ERROR }[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 407 | ▶ | my $exhaustion_action = $gpar{ +EXHAUSTION } // [ ( +RETURN ) => undef ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$gpar{"exhaustion"} // ["return", undef]
MC/DC100%1/1
$gpar{"exhaustion"} // ["return", undef]
$gpar{"exhaustion"}
Truth table100%2/2
A
A= $gpar{"exhaustion"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | my @exhaustion_action | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 407 | ▶ | = Ref::Util::is_arrayref( $exhaustion_action ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ? ( $exhaustion_action->@* ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | : ( $exhaustion_action ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 407 | $gpar{ +EXHAUSTION } = \@exhaustion_action; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 407 | ▶ | if ( $exhaustion_action[0] eq RETURN ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 303 | push @roles, 'Exhaustion::Return'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | elsif ( $exhaustion_action[0] eq THROW ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 104 | ▶ | push @roles, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@exhaustion_action > 1 and $exhaustion_action[1] eq "passthrough"
MC/DC50%1/2
@exhaustion_action > 1 and $exhaustion_action[1] eq "passthrough"
@exhaustion_action > 1
$exhaustion_action[1] eq "passthrough"
Truth table66%2/3
A and B
A= @exhaustion_action > 1B= $exhaustion_action[1] eq "passthrough"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | @exhaustion_action > 1 && $exhaustion_action[1] eq PASSTHROUGH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ? 'Exhaustion::PassthroughThrow' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | : 'Exhaustion::Throw'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | throw_failure( parameter => "unknown exhaustion action: $exhaustion_action[0]" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 407 | ▶ | if ( defined( my $par = $ipar{ +METHODS } ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 17 | require Iterator::Flex::Method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 17 | ▶ | throw_failure( parameter => q{value for methods parameter must be a hash reference} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | unless Ref::Util::is_hashref( $par ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 17 | for my $name ( keys $par->%* ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 29 | my $code = $par->{$name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 29 | ▶ | throw_failure( parameter => "value for 'methods' parameter key '$name' must be a code reference" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | unless Ref::Util::is_coderef( $code ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # create role for the method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 29 | my $role = eval { Iterator::Flex::Method::Maker( $name, name => $name ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 29 | ▶ | if ( $@ ne q{} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 20 | my $error = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 20 | ▶ | die $error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
Ref::Util::XS::is_blessed_ref($error) and $error->isa("Iterator::Flex::Failure::RoleExists")
MC/DC0%0/2
Ref::Util::XS::is_blessed_ref($error) and $error->isa("Iterator::Flex::Failure::RoleExists")
Ref::Util::XS::is_blessed_ref($error)
$error->isa("Iterator::Flex::Failure::RoleExists")
Truth table33%1/3
A and B
A= Ref::Util::XS::is_blessed_ref($error)B= $error->isa("Iterator::Flex::Failure::RoleExists")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | unless Ref::Util::is_blessed_ref( $error ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | && $error->isa( 'Iterator::Flex::Failure::RoleExists' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 20 | $role = $error->payload; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 29 | push @roles, q{+} . $role; # need '+', as these are fully qualified role module names. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 407 | @roles = map { load_role( $_, $class->_role_namespaces ) } @roles; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 407 | $class = Role::Tiny->create_class_with_roles( $class, @roles ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 407 | ▶ | unless ( $class->can( '_construct_next' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | throw_failure( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | class => "Constructed class '$class' does not provide the required _construct_next method\n" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 407 | ▶ | unless ( $class->does( 'Iterator::Flex::Role::State' ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | throw_failure( class => "Constructed class '$class' does not provide a State role\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 407 | ▶ | $ipar{ +_NAME } //= $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ipar{"_name"} //= $class
MC/DC0%0/2
$ipar{"_name"} //= $class
$ipar{"_name"}
$class
Truth table66%2/3
A //= B
A= $ipar{"_name"}B= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 407 | my $self = bless $class->_construct_next( \%ipar, \%gpar ), $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | throw_failure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | parameter => q{attempt to register an iterator subroutine which has already been registered.} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 407 | ▶ | if exists $REGISTRY{ refaddr $self }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 407 | my $regentry = $REGISTRY{ refaddr $self } = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # convert to arrays. some of the parameter values are weak | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # references so make sure we don't unweaken them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 407 | my @ipar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 407 | for my $key ( keys %ipar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3108 | $ipar[ $RegIterationIndexMap{$key} ] = $ipar{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | Scalar::Util::weaken $ipar[ $RegIterationIndexMap{$key} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | if Ref::Util::is_ref( $ipar{$key} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3108 | ▶ | && Scalar::Util::isweak( $ipar{$key} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
Ref::Util::XS::is_ref($ipar{$key}) and builtin::is_weak($ipar{$key})
MC/DC100%2/2
Ref::Util::XS::is_ref($ipar{$key}) and builtin::is_weak($ipar{$key})
Ref::Util::XS::is_ref($ipar{$key})
builtin::is_weak($ipar{$key})
Truth table100%3/3
A and B
A= Ref::Util::XS::is_ref($ipar{$key})B= builtin::is_weak($ipar{$key})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 407 | my @gpar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 407 | for my $key ( keys %gpar ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 907 | $gpar[ $RegGeneralParameterIndexMap{$key} ] = $gpar{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | Scalar::Util::weaken $gpar[ $RegGeneralParameterIndexMap{$key} ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | if Ref::Util::is_ref( $gpar{$key} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 907 | ▶ | && Scalar::Util::isweak( $gpar{$key} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
Ref::Util::XS::is_ref($gpar{$key}) and builtin::is_weak($gpar{$key})
MC/DC0%0/2
Ref::Util::XS::is_ref($gpar{$key}) and builtin::is_weak($gpar{$key})
Ref::Util::XS::is_ref($gpar{$key})
builtin::is_weak($gpar{$key})
Truth table66%2/3
A and B
A= Ref::Util::XS::is_ref($gpar{$key})B= builtin::is_weak($gpar{$key})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 407 | $regentry->[REG_ITERATOR] = \@ipar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 407 | $regentry->[REG_GENERAL] = \@gpar; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 407 | $self->_clear_state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 407 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 407 | ▶ | sub _validate_interface_pars ( $class, $pars ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_interface_pars: called CC=7 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 407 | state %InterfaceParameters = {}->%{ +INTERFACE_PARAMETER_VALUES }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 407 | my @bad = grep { !exists $InterfaceParameters{$_} } keys $pars->%*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | throw_failure( parameter => "unknown interface parameters: @{[ join ', ', @bad ]}" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | if @bad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | throw_failure( parameter => "@{[ _ROLES ]} must be an arrayref" ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 407 | ▶ | if defined $pars->{_ROLES} && !Ref::Util::is_arrayref( $pars->{ +_ROLES } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $pars->{"_ROLES"} and not Ref::Util::XS::is_arrayref($pars->{"_roles"})
MC/DC0%0/2
defined $pars->{"_ROLES"} and not Ref::Util::XS::is_arrayref($pars->{"_roles"})
defined $pars->{"_ROLES"}
not Ref::Util::XS::is_arrayref($pars->{"_roles"})
Truth table33%1/3
A and not(B)
A= defined $pars->{"_ROLES"}B= not Ref::Util::XS::is_arrayref($pars->{"_roles"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 407 | ▶ | if ( defined( my $par = $pars->{ +_DEPENDS } ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 101 | ▶ | $pars->{ +_DEPENDS } = $par = [$par] unless Ref::Util::is_arrayref( $par ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | throw_failure( parameter => "dependency #$_ is not an iterator object" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 101 | ▶ | unless List::Util::all { $class->_is_iterator( $_ ) } $par->@*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 407 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 407 | ▶ | sub _validate_signal_pars ( $class, $pars ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_validate_signal_pars: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 407 | state %SignalParameters = {}->%{ +SIGNAL_PARAMETER_VALUES }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 407 | my @bad = grep { !exists $SignalParameters{$_} } keys $pars->%*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | throw_failure( parameter => "unknown signal parameters: @{[ join ', ', @bad ]}" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | if @bad; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 404 | ▶ | sub DESTROY ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 404 | ▶ | if ( defined $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 404 | delete $REGISTRY{ refaddr $self }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ▶ | sub _name ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER__NAME]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # TODO: this is too restrictive. It should allow simple coderefs, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # things with a next or __next__. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 141 | ▶ | sub _is_iterator ( $, $obj ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_iterator: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 141 | ▶ | return Ref::Util::is_blessed_ref( $obj ) && $obj->isa( __PACKAGE__ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
Ref::Util::XS::is_blessed_ref($obj) && $obj->isa(__PACKAGE__)
MC/DC0%0/2
Ref::Util::XS::is_blessed_ref($obj) && $obj->isa(__PACKAGE__)
Ref::Util::XS::is_blessed_ref($obj)
$obj->isa(__PACKAGE__)
Truth table33%1/3
A && B
A= Ref::Util::XS::is_blessed_ref($obj)B= $obj->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub __iter__ ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__iter__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | return $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER_NEXT]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | ▶ | sub may ( $self, $meth ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
may: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 16 | my \@attributes = $REGISTRY{ refaddr $self }[REG_ITERATOR]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 16 | ▶ | my $may = $attributes[REG_ITER_MAY_METHOD] //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$attributes[13] //= {}
MC/DC100%1/1
$attributes[13] //= {}
$attributes[13]
Truth table100%2/2
A
A= $attributes[13]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | return $may->{"_may_$meth"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | //= defined $attributes[REG_ITER__DEPENDS] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 3 | ▶ | ? !List::Util::first { !$_->may( $meth ) } $attributes[REG_ITER__DEPENDS]->@* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 16 | ▶ | : defined $attributes[ $RegIterationIndexMap{$meth} ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$$may{"_may_$meth"} //= defined $attributes[9] ? !&List::Util::first(sub {
not $_->may($meth);
}
, @{$attributes[9]}) : defined $attributes[$Iterator::Flex::Base::RegIterationIndexMap{$meth}]
MC/DC0%0/1
$$may{"_may_$meth"} //= defined $attributes[9] ? !&List::Util::first(sub {
not $_->may($meth);
}
, @{$attributes[9]}) : defined $attributes[$Iterator::Flex::Base::RegIterationIndexMap{$meth}]
$$may{"_may_$meth"}
Truth table50%1/2
A
A= $$may{"_may_$meth"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 3 | ▶ | sub _namespaces { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_namespaces: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 3 | return 'Iterator::Flex'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1825 | ▶ | sub _role_namespaces { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_role_namespaces: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1825 | return 'Iterator::Flex::Role'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 73 | ▶ | sub _add_roles ( $class, @roles ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_roles: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | Role::Tiny->apply_roles_to_package( $class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 73 | map { load_role( $_, $class->_role_namespaces ) } @roles ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 198 | ▶ | sub _apply_method_to_depends ( $self, $meth ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_apply_method_to_depends: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 198 | ▶ | if ( defined( my $depends = $REGISTRY{ refaddr $self }[REG_ITERATOR][REG_ITER__DEPENDS] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # first check if dependencies have method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 63 | ▶ | my $cant = List::Util::first { !$_->can( $meth ) } $depends->@*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 63 | ▶ | throw_failure( Unsupported => "dependency: @{[ $cant->_name ]} does not have a '$meth' method" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | if $cant; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # now apply the method | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 62 | $_->$meth foreach $depends->@*; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 1213 | ▶ | sub is_exhausted ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_exhausted: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 1213 | $self->get_state == IterState_EXHAUSTED; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 573 | ▶ | sub set_exhausted ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_exhausted: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 573 | $self->set_state( IterState_EXHAUSTED ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 627 | ▶ | sub _clear_state ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_clear_state: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 627 | $self->set_state( IterState_CLEAR ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 2 | ▶ | sub is_error ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_error: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 2 | $self->get_state == IterState_ERROR; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 2 | ▶ | sub set_error ( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_error: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 2 | $self->set_state( IterState_ERROR ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 2 | ▶ | sub throws_on_exhaustion( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throws_on_exhaustion: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | return $REGISTRY{ refaddr $self }[REG_GENERAL][REG_GP_EXHAUSTION][0] eq THROW; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | ▶ | sub returns_on_exhaustion( $self ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
returns_on_exhaustion: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | return $REGISTRY{ refaddr $self }[REG_GENERAL][REG_GP_EXHAUSTION][0] eq RETURN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 1 | ▶ | sub buffer ( $self, $n = 0, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
buffer: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 1 | require Iterator::Flex::Buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 1 | Iterator::Flex::Buffer->new( $self, $n, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 1 | ▶ | sub cache ( $self, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cache: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | require Iterator::Flex::Cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1 | Iterator::Flex::Cache->new( $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | sub icache; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 55 | *icache = \&cache; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 1 | ▶ | sub cat ( $self, @args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cat: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 1 | require Iterator::Flex::Cat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | Iterator::Flex::Cat->new( $self, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | sub chain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 55 | *chain = \&cat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 7 | ▶ | sub chunk ( $self, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chunk: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 7 | require Iterator::Flex::Chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | 7 | Iterator::Flex::Chunk->new( $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | sub ichunk; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 55 | *ichunk = \&chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | sub batch; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 55 | *batch = \&chunk; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 117 | ▶ | sub drain ( $self, $n = undef ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drain: called CC=13 SCAR=25.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 117 | ▶ | throw_failure( parameter => '$n is not a positive integer' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
defined $n and not &Scalar::Util::looks_like_number($n) && int $n == $n && $n > 0
&Scalar::Util::looks_like_number($n) && int $n == $n && $n > 0
&Scalar::Util::looks_like_number($n) and int $n == $n
MC/DC50%2/4
defined $n and not &Scalar::Util::looks_like_number($n) && int $n == $n && $n > 0
defined $n
&Scalar::Util::looks_like_number($n)
int $n == $n
$n > 0
Truth table60%3/5
A and not(B and C && D)
A= defined $nB= &Scalar::Util::looks_like_number($n)C= int $n == $nD= $n > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | if defined $n && !( Scalar::Util::looks_like_number( $n ) && int( $n ) == $n && $n > 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 116 | my @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 116 | ▶ | if ( $n ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | 41 | ▶ | while ( $n-- ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 148 | push @values, $self->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 148 | ▶ | if ( $self->is_exhausted ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 1 | pop @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 75 | while ( 1 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 505 | push @values, $self->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 502 | ▶ | if ( $self->is_exhausted ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 72 | pop @values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 72 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 113 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 116 | ▶ | } or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 3 | ▶ | die $@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
Ref::Util::XS::is_blessed_ref($@) and $@->isa("Iterator::Flex::Failure::Exhausted")
MC/DC50%1/2
Ref::Util::XS::is_blessed_ref($@) and $@->isa("Iterator::Flex::Failure::Exhausted")
Ref::Util::XS::is_blessed_ref($@)
$@->isa("Iterator::Flex::Failure::Exhausted")
Truth table66%2/3
A and B
A= Ref::Util::XS::is_blessed_ref($@)B= $@->isa("Iterator::Flex::Failure::Exhausted")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | unless Ref::Util::is_blessed_ref( $@ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | && $@->isa( 'Iterator::Flex::Failure::Exhausted' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 114 | return \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 1 | ▶ | sub flatten ( $self, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flatten: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 1 | require Iterator::Flex::Flatten; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 1 | return Iterator::Flex::Flatten->new( $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | sub iflatten; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 55 | *iflatten = \*flatten; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 2 | ▶ | sub foreach ( $self, $code ) { ## no critic (BuiltinHomonyms) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foreach: called CC=9 SCAR=27.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 2 | ▶ | if ( $self->throws_on_exhaustion ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | eval { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 1 | local $_; ## no critic (InitializationForLocalVars) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 1 | while ( 1 ) { $_ = $self->(); $code->() } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 1 | ▶ | } or do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 1 | ▶ | die $@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
Ref::Util::XS::is_blessed_ref($@) and $@->isa("Iterator::Flex::Failure::Exhausted")
MC/DC0%0/2
Ref::Util::XS::is_blessed_ref($@) and $@->isa("Iterator::Flex::Failure::Exhausted")
Ref::Util::XS::is_blessed_ref($@)
$@->isa("Iterator::Flex::Failure::Exhausted")
Truth table33%1/3
A and B
A= Ref::Util::XS::is_blessed_ref($@)B= $@->isa("Iterator::Flex::Failure::Exhausted")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | unless Ref::Util::is_blessed_ref( $@ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | && $@->isa( 'Iterator::Flex::Failure::Exhausted' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | elsif ( $self->returns_on_exhaustion ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | # optimize for when sentinel is the undefined value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 1 | ▶ | if ( !defined $self->sentinel ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 1 | local $_; ## no critic (InitializationForLocalVars) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 1 | ▶ | $code->() while defined( $_ = $self->() ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | # yeah, this is too slow. should adapt the logic in Wrap::Return. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 0 | local $_; ## no critic (InitializationForLocalVars) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 0 | $_ = $self->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | until ( $self->is_exhausted ) { ## no critic (UntilBlock) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | $code->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | $_ = $self->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 9 | ▶ | sub gather ( $self, $code, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gather: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 9 | require Iterator::Flex::Gather; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 9 | Iterator::Flex::Gather->new( $code, $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | sub igather; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 55 | *igather = \&gather; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 1 | ▶ | sub grep ( $self, $code, $pars = {} ) { ## no critic (BuiltinHomonyms) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grep: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 1 | require Iterator::Flex::Grep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 1 | Iterator::Flex::Grep->new( $code, $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | sub igrep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 55 | *igrep = \&grep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 3 | ▶ | sub map ( $self, $code, $pars = {} ) { ## no critic (BuiltinHomonyms) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 3 | require Iterator::Flex::Map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 3 | Iterator::Flex::Map->new( $code, $self, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | sub imap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 55 | *imap = \↦ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | ▶ | sub take ( $self, $n, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
take: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 1 | require Iterator::Flex::Take; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 1 | Iterator::Flex::Take->new( $self, $n, $pars ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | 55 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | # This file is part of Iterator-Flex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # The GNU General Public License, Version 3, June 2007 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||