| 1 | package Iterator::Flex::Gather; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Gather Iterator Class | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use v5.28; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use experimental 'signatures'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | our $VERSION = '0.33'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use Iterator::Flex::Factory 'to_iterator'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Iterator::Flex::Utils qw[ THROW STATE EXHAUSTION :IterAttrs :IterStates ]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Ref::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use parent 'Iterator::Flex::Base'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use Iterator::Flex::Gather::Constants ':all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 10 | ▶ | sub new ( $class, $code, $iterable, $pars = {} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 10 | ▶ | throw_failure( parameter => q{'code' parameter is not a coderef} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | unless Ref::Util::is_coderef( $code ); | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 10 | my %pars = $pars->%*; | |||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | my %state = ( | ||||||||||||||||||||||||||||||||||||||||||
| 179 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 10 | ▶ | cycle_on_exhaustion => delete( $pars{cycle_on_exhaustion} ) // GATHER_CYCLE_STOP, | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $pars{"cycle_on_exhaustion"} // 32
MC/DC100%1/1
delete $pars{"cycle_on_exhaustion"} // 32
delete $pars{"cycle_on_exhaustion"}
Truth table100%2/2
A
A= delete $pars{"cycle_on_exhaustion"}
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | src => $iterable, | ||||||||||||||||||||||||||||||||||||||||||
| 182 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | throw_failure( parameter => q{'cycle_on_exhaustion': illegal value} ) | ||||||||||||||||||||||||||||||||||||||||||
| 185 | if defined $pars{cycle_on_exhaustion} | ||||||||||||||||||||||||||||||||||||||||||
| 186 | and $pars{cycle_on_exhaustion} != GATHER_CYCLE_CHOOSE | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 10 | ▶ | and !$pars{cycle_on_exhaustion} & ( GATHER_CYCLE_STOP | GATHER_CYCLE_ABORT ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $pars{"cycle_on_exhaustion"} and $pars{"cycle_on_exhaustion"} != 65 and !$pars{"cycle_on_exhaustion"} & 96
defined $pars{"cycle_on_exhaustion"} and $pars{"cycle_on_exhaustion"} != 65
MC/DC0%0/3
defined $pars{"cycle_on_exhaustion"} and $pars{"cycle_on_exhaustion"} != 65 and !$pars{"cycle_on_exhaustion"} & 96
defined $pars{"cycle_on_exhaustion"}
$pars{"cycle_on_exhaustion"} != 65
!$pars{"cycle_on_exhaustion"} & 96
Truth table25%1/4
A and B and not(C)
A= defined $pars{"cycle_on_exhaustion"}B= $pars{"cycle_on_exhaustion"} != 65C= !$pars{"cycle_on_exhaustion"} & 96
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 10 | $class->SUPER::new( \%state, \%pars ); | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | ▶ | sub construct ( $class, $state ) { | |||||||||||||||||||||||||||||||||||||||||
|
Subroutine
construct: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 10 | ▶ | throw_failure( parameter => q{'state' parameter must be a HASH reference} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | unless Ref::Util::is_hashref( $state ); | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 10 | my ( $code, $src, $cycle_on_exhaustion ) = @{$state}{qw[ code src cycle_on_exhaustion ]}; | |||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 10 | $src | |||||||||||||||||||||||||||||||||||||||||
| 201 | = to_iterator( $src, { ( +EXHAUSTION ) => THROW } ); | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 10 | my $self; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # cached value if current element should be in | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # next cycle | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 10 | my $has_cache = !!0; | |||||||||||||||||||||||||||||||||||||||||
| 208 | 10 | my $cache; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | my $iterator_state; | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | # This iterator may have to delay signalling exhaustion for one cycle if the | ||||||||||||||||||||||||||||||||||||||||||
| 213 | # input iterator is exhausted, and it needs to return the last group of elements. | ||||||||||||||||||||||||||||||||||||||||||
| 214 | # exhaustion. | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 10 | my $next_is_exhausted = !!0; | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ( +_NAME ) => 'igather', | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | ( +_SELF ) => \$self, | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | ( +STATE ) => \$iterator_state, | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | ( +NEXT ) => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 225 | 61 | ▶ | return $self->signal_exhaustion | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=17 SCAR=28.7
Branch: 1 branch
Condition66%2/3
$iterator_state == 1 or $next_is_exhausted
MC/DC50%1/2
$iterator_state == 1 or $next_is_exhausted
$iterator_state == 1
$next_is_exhausted
Truth table66%2/3
A or B
A= $iterator_state == 1B= $next_is_exhausted
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | if $iterator_state == IterState_EXHAUSTED || $next_is_exhausted; | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 54 | my $cycle; | |||||||||||||||||||||||||||||||||||||||||
| 229 | my @gathered; | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 54 | my $ret = eval { | |||||||||||||||||||||||||||||||||||||||||
| 231 | 54 | while ( 1 ) { | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 324 | ▶ | my $rv = $has_cache ? $cache : $src->(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 312 | $has_cache = !!0; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 312 | local $_ = $rv; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 312 | my $result = $code->( \@gathered, GATHER_GATHERING ); | |||||||||||||||||||||||||||||||||||||||||
| 238 | 312 | $cycle = $result & GATHER_CYCLE_MASK; | |||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 312 | ▶ | throw_failure( parameter => 'cycle action (continue, stop, abort, restart) was not specified' ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | unless $cycle; | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 312 | ▶ | if ( ( $result & GATHER_ELEMENT_MASK ) == GATHER_ELEMENT_INCLUDE ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 193 | push @gathered, $rv; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | elsif ( ( $result & GATHER_ELEMENT_MASK ) == GATHER_ELEMENT_CACHE ) { | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 7 | ▶ | throw_failure( parameter => | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 'inconsistent return: element action GATHER_ELEMENT_CACHE requires cycle action GATHER_CYCLE_STOP', | ||||||||||||||||||||||||||||||||||||||||||
| 249 | ) unless $cycle & GATHER_CYCLE_RESTART; | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 7 | $cache = $rv; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 7 | $has_cache = !!1; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 312 | ▶ | last if $cycle & ( GATHER_CYCLE_RESTART | GATHER_CYCLE_STOP | GATHER_CYCLE_ABORT ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 42 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 257 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 54 | ▶ | if ( !$ret && length $@ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $ret and length $@
MC/DC50%1/2
not $ret and length $@
not $ret
length $@
Truth table66%2/3
not(A) and B
A= not $retB= length $@
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 12 | ▶ | 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")
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | unless Ref::Util::is_blessed_ref( $@ ) | ||||||||||||||||||||||||||||||||||||||||||
| 262 | && $@->isa( 'Iterator::Flex::Failure::Exhausted' ); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 12 | local $_ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 265 | 12 | ▶ | my $result | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | = $cycle_on_exhaustion == GATHER_CYCLE_CHOOSE | ||||||||||||||||||||||||||||||||||||||||||
| 267 | ? $code->( \@gathered, GATHER_SRC_EXHAUSTED ) | ||||||||||||||||||||||||||||||||||||||||||
| 268 | : $cycle_on_exhaustion; | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 12 | ▶ | return $self->signal_exhaustion | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$result & 64 or $result & 32 and not @gathered
$result & 32 and not @gathered
MC/DC66%2/3
$result & 64 or $result & 32 and not @gathered
$result & 64
$result & 32
not @gathered
Truth table75%3/4
A or B and not(C)
A= $result & 64B= $result & 32C= not @gathered
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | if ( $result & GATHER_CYCLE_ABORT ) | ||||||||||||||||||||||||||||||||||||||||||
| 271 | || ( $result & GATHER_CYCLE_STOP && !@gathered ); | ||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | 7 | $next_is_exhausted = !!1; | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 49 | return \@gathered; | |||||||||||||||||||||||||||||||||||||||||
| 277 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 278 | ( | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 10 | map { ( ( +RESET ) => $_, ( +REWIND ) => $_, ) } sub { | |||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | ▶ | $next_is_exhausted = $has_cache = !!0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 10 | ), | |||||||||||||||||||||||||||||||||||||||||
| 283 | ( +_DEPENDS ) => $src, | ||||||||||||||||||||||||||||||||||||||||||
| 284 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 3 | __PACKAGE__->_add_roles( qw[ | |||||||||||||||||||||||||||||||||||||||||
| 288 | State::Closure | ||||||||||||||||||||||||||||||||||||||||||
| 289 | Next::ClosedSelf | ||||||||||||||||||||||||||||||||||||||||||
| 290 | Rewind::Closure | ||||||||||||||||||||||||||||||||||||||||||
| 291 | Reset::Closure | ||||||||||||||||||||||||||||||||||||||||||
| 292 | Current::Closure | ||||||||||||||||||||||||||||||||||||||||||
| 293 | ] ); | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | # | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # This file is part of Iterator-Flex | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory. | ||||||||||||||||||||||||||||||||||||||||||
| 301 | # | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||
| 303 | # | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # The GNU General Public License, Version 3, June 2007 | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | __END__ | ||||||||||||||||||||||||||||||||||||||||||