line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package List::Enumerator::Sub; |
2
|
5
|
|
|
5
|
|
32
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
209
|
|
3
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
166
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
30
|
use base qw/List::Enumerator::Role/; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
534
|
|
6
|
|
|
|
|
|
|
use overload |
7
|
5
|
|
|
|
|
58
|
'@{}' => \&getarray, |
8
|
5
|
|
|
5
|
|
39
|
fallback => 1; |
|
5
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/next_sub rewind_sub/); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub BUILD { |
13
|
101
|
|
|
101
|
0
|
156
|
my ($self, $params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
101
|
|
|
|
|
316
|
$self->next_sub($params->{next}); |
16
|
101
|
|
100
|
0
|
|
5908
|
$self->rewind_sub($params->{rewind} || sub {}); |
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _next { |
20
|
862
|
|
|
862
|
|
1146
|
my ($self, $new) = @_; |
21
|
|
|
|
|
|
|
|
22
|
862
|
|
|
|
|
979
|
local $_ = $self; |
23
|
862
|
|
|
|
|
1933
|
$self->next_sub->($self); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _rewind { |
27
|
14
|
|
|
14
|
|
25
|
my ($self, $new) = @_; |
28
|
|
|
|
|
|
|
|
29
|
14
|
|
|
|
|
22
|
local $_ = $self; |
30
|
14
|
|
|
|
|
44
|
$self->rewind_sub->($self); |
31
|
14
|
|
|
|
|
30
|
$self; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub getarray { |
35
|
1
|
|
|
1
|
0
|
20
|
my ($self) = @_; |
36
|
1
|
|
|
|
|
3
|
my @temp; |
37
|
1
|
|
|
|
|
7
|
tie @temp, __PACKAGE__, $self; |
38
|
1
|
|
|
|
|
6
|
\@temp; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub TIEARRAY { |
42
|
1
|
|
|
1
|
|
2
|
my ($class, $arg) = @_; |
43
|
1
|
|
|
|
|
5
|
bless $arg, $class; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub FETCHSIZE { |
47
|
0
|
|
|
0
|
|
0
|
0; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub FETCH { #TODO orz orz orz |
51
|
1
|
|
|
1
|
|
2
|
my ($self, $index) = @_; |
52
|
1
|
|
|
|
|
15
|
$self->rewind; |
53
|
1
|
|
|
|
|
15
|
$self->next while ($index--); |
54
|
1
|
|
|
|
|
12
|
$self->next; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
__END__ |