| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Data::ObjectDriver::Iterator; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
187
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my %Iterators = (); |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
|
10
|
0
|
|
|
|
|
|
my( $each, $end ) = @_; |
|
11
|
0
|
|
|
|
|
|
bless $each, $class; |
|
12
|
0
|
0
|
|
|
|
|
if ($end) { |
|
13
|
0
|
|
|
|
|
|
$Iterators{ $each }{ end } = $end; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
0
|
|
|
|
|
|
return $each; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub next { |
|
19
|
0
|
|
|
0
|
0
|
|
return shift->(); |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub end { |
|
23
|
0
|
|
|
0
|
0
|
|
my $each = shift; |
|
24
|
0
|
|
|
|
|
|
my $hash = delete $Iterators{ $each }; |
|
25
|
0
|
0
|
0
|
|
|
|
$hash->{ end }->() if $hash and ref $hash->{ end } eq 'CODE'; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub DESTROY { |
|
29
|
0
|
|
|
0
|
|
|
my $iter = shift; |
|
30
|
|
|
|
|
|
|
# use YAML; warn Dump \%Iterators; |
|
31
|
0
|
|
|
|
|
|
$iter->end(); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |