line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Diamond; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
106500
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
151
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub TIEARRAY { |
10
|
2
|
|
|
2
|
|
3967
|
my $class = shift; |
11
|
2
|
|
100
|
|
|
14
|
my $opts = shift // {}; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
16
|
bless { size=>0, eof=>0, opts=>$opts }, $class; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub FETCH { |
17
|
6
|
|
|
6
|
|
8
|
my $self = shift; |
18
|
6
|
|
|
|
|
7
|
my $index = shift; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#print "FETCH($index)\n"; |
21
|
6
|
50
|
|
|
|
14
|
if ($self->{eof}) { |
22
|
0
|
|
|
|
|
0
|
return undef; |
23
|
|
|
|
|
|
|
} else { |
24
|
6
|
|
|
|
|
24
|
return $self->{rec}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub FETCHSIZE { |
29
|
8
|
|
|
8
|
|
72
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
8
|
|
|
|
|
9
|
my $size; |
32
|
8
|
50
|
|
|
|
18
|
if ($self->{eof}) { |
33
|
0
|
|
|
|
|
0
|
$size = $self->{size}; |
34
|
|
|
|
|
|
|
} else { |
35
|
8
|
|
|
|
|
10
|
my $rec; |
36
|
8
|
50
|
|
|
|
18
|
if ($self->{opts}{utf8}) { |
37
|
1
|
|
|
1
|
|
740
|
use open ':std', ':utf8'; |
|
1
|
|
|
|
|
1190
|
|
|
1
|
|
|
|
|
6
|
|
38
|
0
|
|
|
|
|
0
|
$rec = <>; |
39
|
|
|
|
|
|
|
} else { |
40
|
8
|
|
|
|
|
155
|
$rec = <>; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
8
|
100
|
|
|
|
17
|
if ($rec) { |
44
|
6
|
|
|
|
|
12
|
$size = ++$self->{size}; |
45
|
6
|
100
|
|
|
|
18
|
chomp($rec) if $self->{opts}{chomp}; |
46
|
6
|
|
|
|
|
13
|
$self->{rec} = $rec; |
47
|
|
|
|
|
|
|
} else { |
48
|
2
|
|
|
|
|
3
|
$self->{eof}++; |
49
|
2
|
|
|
|
|
5
|
$size = $self->{size}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
#print "FETCHSIZE() -> $size\n"; |
53
|
8
|
|
|
|
|
33
|
$size; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
# ABSTRACT: Iterate the diamond operator via a Perl array |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |