line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tie::Array::Lazy; |
2
|
4
|
|
|
4
|
|
26195
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
117
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
3140
|
|
4
|
|
|
|
|
|
|
our $VERSION = sprintf "%d.%02d", q$Revision: 0.2 $ =~ /(\d+)/g; |
5
|
|
|
|
|
|
|
|
6
|
0
|
|
|
0
|
|
0
|
sub DESTROY { } |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub TIEARRAY($\@\&;@){ |
9
|
4
|
|
|
4
|
|
2463
|
my ( $pkg, $array, $maker ) = splice @_, 0, 3; |
10
|
4
|
|
|
|
|
36
|
bless { _array => $array, _maker => $maker, @_ }, $pkg; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
57
|
|
|
57
|
1
|
2075
|
sub array { $_[0]->{_array} } |
14
|
27
|
|
|
27
|
1
|
63
|
sub index { scalar @{ $_[0]->array } } |
|
27
|
|
|
|
|
58
|
|
15
|
15
|
|
|
15
|
1
|
50
|
sub maker { $_[0]->{_maker} } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub EXTEND($$) { |
18
|
5
|
|
|
5
|
|
9
|
my ( $self, $size ) = @_; |
19
|
5
|
|
|
|
|
15
|
my $index = $self->index; |
20
|
5
|
|
|
|
|
23
|
while ($index <= $size){ |
21
|
10
|
|
|
|
|
24
|
$self->array->[$index] = $self->maker->($self, $index); |
22
|
10
|
|
|
|
|
29
|
$index++; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub FETCH($$) { |
27
|
1
|
|
|
1
|
|
1091
|
my ( $self, $index ) = @_; |
28
|
1
|
|
|
|
|
7
|
$self->EXTEND($index); |
29
|
1
|
|
|
|
|
3
|
$self->array->[$index]; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub STORE($$$) { |
33
|
0
|
|
|
0
|
|
0
|
my ( $self, $index, $value ) = @_; |
34
|
0
|
|
|
|
|
0
|
$self->EXTEND($index-1); |
35
|
0
|
|
|
|
|
0
|
$self->array->[$index] = $value; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
|
0
|
sub STORESIZE($) { } |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
0
|
|
0
|
sub FETCHSIZE($) { scalar @{ $_[0]->array } + 1 } |
|
0
|
|
|
|
|
0
|
|
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
2
|
|
15
|
sub PUSH($@) { push @{ shift->array }, @_ } |
|
2
|
|
|
|
|
11
|
|
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
|
11
|
sub UNSHIFT($@) { unshift @{ shift->array }, @_ } |
|
2
|
|
|
|
|
6
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub SHIFT($) { |
47
|
4
|
100
|
|
4
|
|
14
|
$_[0]->index ? shift @{ $_[0]->array } : $_[0]->maker->( $_[0] ) |
|
2
|
|
|
|
|
6
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub POP($) { |
51
|
4
|
100
|
|
4
|
|
17
|
$_[0]->index ? pop @{ $_[0]->array } : $_[0]->maker->( $_[0] ) |
|
2
|
|
|
|
|
5
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
|
0
|
sub CLEAR($){ @{$_[0]->array} = () } |
|
0
|
|
|
|
|
0
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub SPLICE($;$$@){ |
57
|
4
|
|
|
4
|
|
9
|
my $self = shift; |
58
|
4
|
50
|
|
|
|
21
|
return splice @{$self->array} unless @_; |
|
0
|
|
|
|
|
0
|
|
59
|
4
|
|
|
|
|
7
|
my $off = shift; |
60
|
4
|
|
|
|
|
15
|
$self->EXTEND( $off + 1); |
61
|
4
|
50
|
|
|
|
17
|
return splice @{$self->array}, $off unless @_; |
|
0
|
|
|
|
|
0
|
|
62
|
4
|
|
|
|
|
7
|
my $len = shift; |
63
|
4
|
50
|
|
|
|
13
|
return splice @{$self->array}, $off, $len unless @_; |
|
4
|
|
|
|
|
11
|
|
64
|
0
|
|
|
|
|
|
splice @{$self->array}, $off, $len, @_; |
|
0
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
__END__ |