| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Iterator::Flex::Map; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Map Iterator Class |
|
4
|
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
216510
|
use v5.28; |
|
|
5
|
|
|
|
|
27
|
|
|
6
|
5
|
|
|
5
|
|
47
|
use strict; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
178
|
|
|
7
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
350
|
|
|
8
|
5
|
|
|
5
|
|
497
|
use experimental 'signatures'; |
|
|
5
|
|
|
|
|
1523
|
|
|
|
5
|
|
|
|
|
56
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.33'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
1521
|
use Iterator::Flex::Utils qw( STATE THROW EXHAUSTION :IterAttrs :IterStates ); |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
1317
|
|
|
13
|
5
|
|
|
5
|
|
709
|
use Iterator::Flex::Factory 'to_iterator'; |
|
|
5
|
|
|
|
|
19
|
|
|
|
5
|
|
|
|
|
461
|
|
|
14
|
5
|
|
|
5
|
|
33
|
use Ref::Util; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
191
|
|
|
15
|
5
|
|
|
5
|
|
26
|
use parent 'Iterator::Flex::Base'; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
5
|
|
398
|
use namespace::clean; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
31
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
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
|
9
|
|
|
9
|
1
|
21
|
sub new ( $class, $code, $iterable, $pars = {} ) { |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
19
|
|
|
|
9
|
|
|
|
|
17
|
|
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
14
|
|
|
49
|
9
|
50
|
|
|
|
35
|
throw_failure( parameter => q{'code' parameter is not a coderef} ) |
|
50
|
|
|
|
|
|
|
unless Ref::Util::is_coderef( $code ); |
|
51
|
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
58
|
$class->SUPER::new( { code => $code, src => $iterable }, $pars ); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
9
|
|
|
9
|
0
|
17
|
sub construct ( $class, $state ) { |
|
|
9
|
|
|
|
|
18
|
|
|
|
9
|
|
|
|
|
14
|
|
|
|
9
|
|
|
|
|
16
|
|
|
56
|
|
|
|
|
|
|
|
|
57
|
9
|
50
|
|
|
|
27
|
throw_failure( parameter => q{'state' parameter must be a HASH reference} ) |
|
58
|
|
|
|
|
|
|
unless Ref::Util::is_hashref( $state ); |
|
59
|
|
|
|
|
|
|
|
|
60
|
9
|
|
|
|
|
15
|
my ( $code, $src ) = @{$state}{qw[ code src ]}; |
|
|
9
|
|
|
|
|
29
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
9
|
|
|
|
|
56
|
$src |
|
63
|
|
|
|
|
|
|
= to_iterator( $src, { ( +EXHAUSTION ) => THROW } ); |
|
64
|
|
|
|
|
|
|
|
|
65
|
9
|
|
|
|
|
50
|
my @values; |
|
66
|
|
|
|
|
|
|
my $self; |
|
67
|
9
|
|
|
|
|
0
|
my $iterator_state; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return { |
|
70
|
|
|
|
|
|
|
( +_NAME ) => 'imap', |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
( +_SELF ) => \$self, |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
( +STATE ) => \$iterator_state, |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
( +NEXT ) => sub { |
|
77
|
106
|
50
|
|
106
|
|
237
|
return $self->signal_exhaustion if $iterator_state == IterState_EXHAUSTED; |
|
78
|
|
|
|
|
|
|
|
|
79
|
106
|
100
|
|
|
|
215
|
unless ( @values ) { |
|
80
|
|
|
|
|
|
|
eval { |
|
81
|
67
|
|
|
|
|
297
|
my $value = $src->(); |
|
82
|
55
|
|
|
|
|
315
|
local $_ = $value; |
|
83
|
55
|
|
|
|
|
143
|
@values = $code->(); |
|
84
|
55
|
|
|
|
|
330
|
1; |
|
85
|
67
|
100
|
|
|
|
108
|
} or do { |
|
86
|
12
|
50
|
33
|
|
|
1236
|
die $@ |
|
87
|
|
|
|
|
|
|
unless Ref::Util::is_blessed_ref( $@ ) |
|
88
|
|
|
|
|
|
|
&& $@->isa( 'Iterator::Flex::Failure::Exhausted' ); |
|
89
|
12
|
|
|
|
|
58
|
return $self->signal_exhaustion; |
|
90
|
|
|
|
|
|
|
}; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
94
|
|
|
|
|
221
|
return shift @values; |
|
93
|
|
|
|
|
|
|
}, |
|
94
|
|
|
|
|
|
|
|
|
95
|
2
|
|
|
2
|
|
6
|
( +RESET ) => sub { @values = () }, |
|
96
|
1
|
|
|
1
|
|
4
|
( +REWIND ) => sub { @values = () }, |
|
97
|
9
|
|
|
|
|
212
|
( +_DEPENDS ) => $src, |
|
98
|
|
|
|
|
|
|
}; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__PACKAGE__->_add_roles( qw[ |
|
103
|
|
|
|
|
|
|
State::Closure |
|
104
|
|
|
|
|
|
|
Next::ClosedSelf |
|
105
|
|
|
|
|
|
|
Reset::Closure |
|
106
|
|
|
|
|
|
|
Rewind::Closure |
|
107
|
|
|
|
|
|
|
] ); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
1; |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# |
|
112
|
|
|
|
|
|
|
# This file is part of Iterator-Flex |
|
113
|
|
|
|
|
|
|
# |
|
114
|
|
|
|
|
|
|
# This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory. |
|
115
|
|
|
|
|
|
|
# |
|
116
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
117
|
|
|
|
|
|
|
# |
|
118
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
|
119
|
|
|
|
|
|
|
# |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |