line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Tie::OffsetArray; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1810
|
use vars qw( $VERSION @ISA ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.01'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require 5.005; |
9
|
1
|
|
|
1
|
|
828
|
use Tie::Array; |
|
1
|
|
|
|
|
1161
|
|
|
1
|
|
|
|
|
29
|
|
10
|
|
|
|
|
|
|
@ISA = qw( Tie::Array ); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
234
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub TIEARRAY { |
17
|
1
|
|
|
1
|
|
53
|
my( $pkg, $offset, $ar ) = @_; |
18
|
1
|
50
|
|
|
|
6
|
$offset >= 0 or die "Offset must be non-negative!"; |
19
|
1
|
50
|
|
|
|
2
|
defined($ar) or $ar = []; |
20
|
1
|
50
|
|
|
|
9
|
$ar =~ /\bARRAY\b/ or die "Illegal argument: $ar\n"; |
21
|
1
|
|
|
|
|
4
|
while ( @$ar < $offset ) { push @$ar, undef } |
|
0
|
|
|
|
|
0
|
|
22
|
1
|
|
|
|
|
5
|
bless [ $offset, $ar ], $pkg |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub FETCH { |
26
|
0
|
|
|
0
|
|
0
|
my( $self, $index ) = @_; |
27
|
0
|
|
|
|
|
0
|
$self->[1][ $index + $self->[0] ] |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub STORE { |
31
|
2
|
|
|
2
|
|
10
|
my( $self, $index, $value ) = @_; |
32
|
2
|
|
|
|
|
13
|
$self->[1][ $index + $self->[0] ] = $value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub FETCHSIZE { |
36
|
1
|
|
|
1
|
|
10
|
my( $self ) = @_; |
37
|
1
|
|
|
|
|
2
|
@{ $self->[1] } - $self->[0] |
|
1
|
|
|
|
|
4
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub STORESIZE { |
41
|
0
|
|
|
0
|
|
0
|
my( $self, $size ) = @_; |
42
|
1
|
|
|
1
|
|
821
|
$#{ $self->[1] } = $size + $self->[0] - 1 + $[; |
|
1
|
|
|
|
|
420
|
|
|
1
|
|
|
|
|
65
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# get (a ref to) the underlying array |
46
|
|
|
|
|
|
|
sub array { |
47
|
1
|
|
|
1
|
0
|
5
|
my( $self ) = @_; |
48
|
1
|
|
|
|
|
3
|
$self->[1] |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |