|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package DBM::Deep::Array;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
3
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
454
 | 
 use 5.008_004;  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
73
 | 
    | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
109
 | 
 use strict;  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
42
 | 
    | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
629
 | 
    | 
| 
6
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
125
 | 
 use warnings FATAL => 'all';  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
42
 | 
    | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
912
 | 
    | 
| 
7
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
114
 | 
 no warnings 'recursion';  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
56
 | 
    | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1291
 | 
    | 
| 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # This is to allow DBM::Deep::Array to handle negative indices on  | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # its own. Otherwise, Perl would intercept the call to negative  | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # indices for us. This was causing bugs for negative index handling.  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $NEGATIVE_INDICES = 1;  | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
14
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
171
 | 
 use base 'DBM::Deep';  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
59
 | 
    | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1741
 | 
    | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
16
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
154
 | 
 use Scalar::Util ();  | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
84
 | 
    | 
| 
 
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
51373
 | 
    | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _get_self {  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # We used to have  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     #  eval { local $SIG{'__DIE__'}; tied( @{$_[0]} ) } || $_[0]  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # but this does not always work during global destruction (DBM::Deep’s  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # destructor calls this method), but will return $_[0] even when $_[0]  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # is tied, if it’s tied to undef. In those cases it’s better to return  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # undef, so the destructor can tell not to do anything,  and,  if any-  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # thing else calls us, it will fail with a more helpful error message.  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
27
 | 
37823
 | 
  
100
  
 | 
 
 | 
  
37823
  
 | 
 
 | 
95007
 | 
     Scalar::Util::reftype $_[0] eq 'ARRAY' ? tied @{$_[0]} : $_[0];  | 
| 
 
 | 
3218
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8080
 | 
    | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
23
 | 
 
 | 
 
 | 
  
23
  
 | 
 
 | 
61
 | 
 sub _repr { [] }  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub TIEARRAY {  | 
| 
33
 | 
2160
 | 
 
 | 
 
 | 
  
2160
  
 | 
 
 | 
3800
 | 
     my $class = shift;  | 
| 
34
 | 
2160
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5264
 | 
     my $args = $class->_get_args( @_ );  | 
| 
35
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
36
 | 
2158
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5299
 | 
     $args->{type} = $class->TYPE_ARRAY;  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
38
 | 
2158
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5459
 | 
     return $class->_init($args);  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub FETCH {  | 
| 
42
 | 
520
 | 
 
 | 
 
 | 
  
520
  
 | 
 
 | 
16789
 | 
     my $self = shift->_get_self;  | 
| 
43
 | 
520
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1007
 | 
     my ($key) = @_;  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
520
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1924
 | 
     $self->lock_shared;  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
47
 | 
520
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
3461
 | 
     if ( !defined $key ) {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
48
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         $self->unlock;  | 
| 
49
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
         DBM::Deep->_throw_error( "Cannot use an undefined array index." );  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key =~ /^-?\d+$/ ) {  | 
| 
52
 | 
231
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
659
 | 
         if ( $key < 0 ) {  | 
| 
53
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
67
 | 
             $key += $self->FETCHSIZE;  | 
| 
54
 | 
11
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
52
 | 
             unless ( $key >= 0 ) {  | 
| 
55
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
                 $self->unlock;  | 
| 
56
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
                 return;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
60
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key ne 'length' ) {  | 
| 
61
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
         $self->unlock;  | 
| 
62
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
         DBM::Deep->_throw_error( "Cannot use '$key' as an array index." );  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
65
 | 
517
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1480
 | 
     my $rv = $self->SUPER::FETCH( $key );  | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
67
 | 
517
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1381
 | 
     $self->unlock;  | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
69
 | 
517
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2296
 | 
     return $rv;  | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub STORE {  | 
| 
73
 | 
303
 | 
 
 | 
 
 | 
  
303
  
 | 
 
 | 
1828
 | 
     my $self = shift->_get_self;  | 
| 
74
 | 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
677
 | 
     my ($key, $value) = @_;  | 
| 
75
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
76
 | 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
830
 | 
     $self->lock_exclusive;  | 
| 
77
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
78
 | 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
549
 | 
     my $size;  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     my $idx_is_numeric;  | 
| 
80
 | 
303
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
2167
 | 
     if ( !defined $key ) {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
81
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         $self->unlock;  | 
| 
82
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         DBM::Deep->_throw_error( "Cannot use an undefined array index." );  | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key =~ /^-?\d+$/ ) {  | 
| 
85
 | 
151
 | 
 
 | 
 
 | 
 
 | 
 
 | 
256
 | 
         $idx_is_numeric = 1;  | 
| 
86
 | 
151
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
381
 | 
         if ( $key < 0 ) {  | 
| 
87
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
             $size = $self->FETCHSIZE;  | 
| 
88
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
77
 | 
             if ( $key + $size < 0 ) {  | 
| 
89
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
                 die( "Modification of non-creatable array value attempted, subscript $key" );  | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
91
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
             $key += $size  | 
| 
92
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
93
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
94
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key ne 'length' ) {  | 
| 
95
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
         $self->unlock;  | 
| 
96
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
         DBM::Deep->_throw_error( "Cannot use '$key' as an array index." );  | 
| 
97
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
98
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
99
 | 
300
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1012
 | 
     my $rv = $self->SUPER::STORE( $key, $value );  | 
| 
100
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
101
 | 
300
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
726
 | 
     if ( $idx_is_numeric ) {  | 
| 
102
 | 
150
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
481
 | 
         $size = $self->FETCHSIZE unless defined $size;  | 
| 
103
 | 
150
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
404
 | 
         if ( $key >= $size ) {  | 
| 
104
 | 
129
 | 
 
 | 
 
 | 
 
 | 
 
 | 
386
 | 
             $self->STORESIZE( $key + 1 );  | 
| 
105
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
106
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
107
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
108
 | 
300
 | 
 
 | 
 
 | 
 
 | 
 
 | 
836
 | 
     $self->unlock;  | 
| 
109
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
110
 | 
300
 | 
 
 | 
 
 | 
 
 | 
 
 | 
865
 | 
     return $rv;  | 
| 
111
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
112
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
113
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub EXISTS {  | 
| 
114
 | 
9
 | 
 
 | 
 
 | 
  
9
  
 | 
 
 | 
1255
 | 
     my $self = shift->_get_self;  | 
| 
115
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
     my ($key) = @_;  | 
| 
116
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
117
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
32
 | 
     $self->lock_shared;  | 
| 
118
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
119
 | 
9
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
98
 | 
     if ( !defined $key ) {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
120
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
         $self->unlock;  | 
| 
121
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
         DBM::Deep->_throw_error( "Cannot use an undefined array index." );  | 
| 
122
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
123
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key =~ /^-?\d+$/ ) {  | 
| 
124
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
21
 | 
         if ( $key < 0 ) {  | 
| 
125
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
             $key += $self->FETCHSIZE;  | 
| 
126
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
11
 | 
             unless ( $key >= 0 ) {  | 
| 
127
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
                 $self->unlock;  | 
| 
128
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
                 return;  | 
| 
129
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
130
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
131
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
132
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key ne 'length' ) {  | 
| 
133
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         $self->unlock;  | 
| 
134
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
         DBM::Deep->_throw_error( "Cannot use '$key' as an array index." );  | 
| 
135
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
136
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
137
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
     my $rv = $self->SUPER::EXISTS( $key );  | 
| 
138
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
139
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
     $self->unlock;  | 
| 
140
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
141
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
     return $rv;  | 
| 
142
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
143
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
144
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub DELETE {  | 
| 
145
 | 
20
 | 
 
 | 
 
 | 
  
20
  
 | 
 
 | 
56
 | 
     my $self = shift->_get_self;  | 
| 
146
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
41
 | 
     my ($key) = @_;  | 
| 
147
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     warn "ARRAY::DELETE($self,$key)\n" if DBM::Deep::DEBUG;  | 
| 
148
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
149
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
56
 | 
     $self->lock_exclusive;  | 
| 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
151
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
51
 | 
     my $size = $self->FETCHSIZE;  | 
| 
152
 | 
20
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
187
 | 
     if ( !defined $key ) {  | 
| 
 
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
153
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         $self->unlock;  | 
| 
154
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
         DBM::Deep->_throw_error( "Cannot use an undefined array index." );  | 
| 
155
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
156
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key =~ /^-?\d+$/ ) {  | 
| 
157
 | 
18
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
57
 | 
         if ( $key < 0 ) {  | 
| 
158
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
             $key += $size;  | 
| 
159
 | 
3
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
9
 | 
             unless ( $key >= 0 ) {  | 
| 
160
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
                 $self->unlock;  | 
| 
161
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
                 return;  | 
| 
162
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
163
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
164
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
165
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     elsif ( $key ne 'length' ) {  | 
| 
166
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
         $self->unlock;  | 
| 
167
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16
 | 
         DBM::Deep->_throw_error( "Cannot use '$key' as an array index." );  | 
| 
168
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
169
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
170
 | 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
     my $rv = $self->SUPER::DELETE( $key );  | 
| 
171
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
172
 | 
16
 | 
  
100
  
 | 
  
100
  
 | 
 
 | 
 
 | 
76
 | 
     if ($rv && $key == $size - 1) {  | 
| 
173
 | 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
         $self->STORESIZE( $key );  | 
| 
174
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
175
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
176
 | 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
49
 | 
     $self->unlock;  | 
| 
177
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
178
 | 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
55
 | 
     return $rv;  | 
| 
179
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
180
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
181
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Now that we have a real Reference sector, we should store arrayzize there.  | 
| 
182
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # However, arraysize needs to be transactionally-aware, so a simple location to  | 
| 
183
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # store it isn't going to work.  | 
| 
184
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub FETCHSIZE {  | 
| 
185
 | 
287
 | 
 
 | 
 
 | 
  
287
  
 | 
 
 | 
13492
 | 
     my $self = shift->_get_self;  | 
| 
186
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
187
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
883
 | 
     $self->lock_shared;  | 
| 
188
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
189
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
694
 | 
     my $SAVE_FILTER = $self->_engine->storage->{filter_fetch_value};  | 
| 
190
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
628
 | 
     $self->_engine->storage->{filter_fetch_value} = undef;  | 
| 
191
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
192
 | 
287
 | 
 
 | 
  
100
  
 | 
 
 | 
 
 | 
678
 | 
     my $size = $self->FETCH('length') || 0;  | 
| 
193
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
194
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
777
 | 
     $self->_engine->storage->{filter_fetch_value} = $SAVE_FILTER;  | 
| 
195
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
196
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
757
 | 
     $self->unlock;  | 
| 
197
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
198
 | 
287
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1049
 | 
     return $size;  | 
| 
199
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
200
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
201
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub STORESIZE {  | 
| 
202
 | 
150
 | 
 
 | 
 
 | 
  
150
  
 | 
 
 | 
330
 | 
     my $self = shift->_get_self;  | 
| 
203
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
348
 | 
     my ($new_length) = @_;  | 
| 
204
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
205
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
444
 | 
     $self->lock_exclusive;  | 
| 
206
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
207
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
412
 | 
     my $SAVE_FILTER = $self->_engine->storage->{filter_store_value};  | 
| 
208
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
323
 | 
     $self->_engine->storage->{filter_store_value} = undef;  | 
| 
209
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
210
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
512
 | 
     my $result = $self->STORE('length', $new_length, 'length');  | 
| 
211
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
212
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
363
 | 
     $self->_engine->storage->{filter_store_value} = $SAVE_FILTER;  | 
| 
213
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
214
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
372
 | 
     $self->unlock;  | 
| 
215
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
216
 | 
150
 | 
 
 | 
 
 | 
 
 | 
 
 | 
288
 | 
     return $result;  | 
| 
217
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
218
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
219
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub POP {  | 
| 
220
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
 
 | 
6
 | 
     my $self = shift->_get_self;  | 
| 
221
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
222
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
     $self->lock_exclusive;  | 
| 
223
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
224
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
     my $length = $self->FETCHSIZE();  | 
| 
225
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
226
 | 
2
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     if ($length) {  | 
| 
227
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         my $content = $self->FETCH( $length - 1 );  | 
| 
228
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
         $self->DELETE( $length - 1 );  | 
| 
229
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
230
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
         $self->unlock;  | 
| 
231
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
232
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         return $content;  | 
| 
233
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
234
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     else {  | 
| 
235
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
         $self->unlock;  | 
| 
236
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
         return;  | 
| 
237
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
238
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
239
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
240
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub PUSH {  | 
| 
241
 | 
8
 | 
 
 | 
 
 | 
  
8
  
 | 
 
 | 
47
 | 
     my $self = shift->_get_self;  | 
| 
242
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
243
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
     $self->lock_exclusive;  | 
| 
244
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
245
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
     my $length = $self->FETCHSIZE();  | 
| 
246
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
247
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
49
 | 
     for my $content (@_) {  | 
| 
248
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
50
 | 
         $self->STORE( $length, $content );  | 
| 
249
 | 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
55
 | 
         $length++;  | 
| 
250
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
251
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
252
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
     $self->unlock;  | 
| 
253
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
254
 | 
8
 | 
 
 | 
 
 | 
 
 | 
 
 | 
30
 | 
     return $length;  | 
| 
255
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
256
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
257
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # XXX This really needs to be something more direct within the file, not a  | 
| 
258
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # fetch and re-store. -RobK, 2007-09-20  | 
| 
259
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _move_value {  | 
| 
260
 | 
29
 | 
 
 | 
 
 | 
  
29
  
 | 
 
 | 
42
 | 
     my $self = shift;  | 
| 
261
 | 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
55
 | 
     my ($old_key, $new_key) = @_;  | 
| 
262
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
263
 | 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
77
 | 
     return $self->_engine->make_reference( $self, $old_key, $new_key );  | 
| 
264
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
265
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
266
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub SHIFT {  | 
| 
267
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
59
 | 
     my $self = shift->_get_self;  | 
| 
268
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
     warn "SHIFT($self)\n" if DBM::Deep::DEBUG;  | 
| 
269
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
270
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
     $self->lock_exclusive;  | 
| 
271
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
272
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
     my $length = $self->FETCHSIZE();  | 
| 
273
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
274
 | 
3
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
11
 | 
     if ( !$length ) {  | 
| 
275
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
         $self->unlock;  | 
| 
276
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
         return;  | 
| 
277
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
278
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
279
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
     my $content = $self->DELETE( 0 );  | 
| 
280
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
281
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Unless the deletion above has cleared the array ...  | 
| 
282
 | 
2
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     if ( $length > 1 ) {  | 
| 
283
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
         for (my $i = 0; $i < $length - 1; $i++) {  | 
| 
284
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
             $self->_move_value( $i+1, $i );  | 
| 
285
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
286
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
287
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
         $self->DELETE( $length - 1 );  | 
| 
288
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
289
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
290
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
     $self->unlock;  | 
| 
291
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
292
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
12
 | 
     return $content;  | 
| 
293
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
294
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
295
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub UNSHIFT {  | 
| 
296
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
101
 | 
     my $self = shift->_get_self;  | 
| 
297
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
     my @new_elements = @_;  | 
| 
298
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
299
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     $self->lock_exclusive;  | 
| 
300
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
301
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
34
 | 
     my $length = $self->FETCHSIZE();  | 
| 
302
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
     my $new_size = scalar @new_elements;  | 
| 
303
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
304
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
23
 | 
     if ($length) {  | 
| 
305
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
         for (my $i = $length - 1; $i >= 0; $i--) {  | 
| 
306
 | 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
68
 | 
             $self->_move_value( $i, $i+$new_size );  | 
| 
307
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
308
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
309
 | 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
28
 | 
         $self->STORESIZE( $length + $new_size );  | 
| 
310
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
311
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
312
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
41
 | 
     for (my $i = 0; $i < $new_size; $i++) {  | 
| 
313
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
29
 | 
         $self->STORE( $i, $new_elements[$i] );  | 
| 
314
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
315
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
316
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
39
 | 
     $self->unlock;  | 
| 
317
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
318
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
45
 | 
     return $length + $new_size;  | 
| 
319
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
320
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
321
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub SPLICE {  | 
| 
322
 | 
7
 | 
 
 | 
 
 | 
  
7
  
 | 
 
 | 
55
 | 
     my $self = shift->_get_self;  | 
| 
323
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
324
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
27
 | 
     $self->lock_exclusive;  | 
| 
325
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
326
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
19
 | 
     my $length = $self->FETCHSIZE();  | 
| 
327
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
328
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
329
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Calculate offset and length of splice  | 
| 
330
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
331
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     my $offset = shift;  | 
| 
332
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
20
 | 
     $offset = 0 unless defined $offset;  | 
| 
333
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
20
 | 
     if ($offset < 0) { $offset += $length; }  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
334
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
335
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
9
 | 
     my $splice_length;  | 
| 
336
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
16
 | 
     if (scalar @_) { $splice_length = shift; }  | 
| 
 
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
    | 
| 
337
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
     else { $splice_length = $length - $offset; }  | 
| 
338
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     if ($splice_length < 0) { $splice_length += ($length - $offset); }  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
    | 
| 
339
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
340
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
341
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Setup array with new elements, and copy out old elements for return  | 
| 
342
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
343
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
15
 | 
     my @new_elements = @_;  | 
| 
344
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
13
 | 
     my $new_size = scalar @new_elements;  | 
| 
345
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
346
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     my @old_elements = map {  | 
| 
347
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
24
 | 
         $self->FETCH( $_ )  | 
| 
 
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
21
 | 
    | 
| 
348
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     } $offset .. ($offset + $splice_length - 1);  | 
| 
349
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
350
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
351
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Adjust array length, and shift elements to accommodate new section.  | 
| 
352
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
353
 | 
7
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
24
 | 
     if ( $new_size != $splice_length ) {  | 
| 
354
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
17
 | 
         if ($new_size > $splice_length) {  | 
| 
355
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
             for (my $i = $length - 1; $i >= $offset + $splice_length; $i--) {  | 
| 
356
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
14
 | 
                 $self->_move_value( $i, $i + ($new_size - $splice_length) );  | 
| 
357
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
358
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
31
 | 
             $self->STORESIZE( $length + $new_size - $splice_length );  | 
| 
359
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
360
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         else {  | 
| 
361
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
             for (my $i = $offset + $splice_length; $i < $length; $i++) {  | 
| 
362
 | 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8
 | 
                 $self->_move_value( $i, $i + ($new_size - $splice_length) );  | 
| 
363
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
364
 | 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
             for (my $i = 0; $i < $splice_length - $new_size; $i++) {  | 
| 
365
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
                 $self->DELETE( $length - 1 );  | 
| 
366
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
                 $length--;  | 
| 
367
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
368
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         }  | 
| 
369
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
370
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
371
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
372
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Insert new elements into array  | 
| 
373
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
374
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
20
 | 
     for (my $i = $offset; $i < $offset + $new_size; $i++) {  | 
| 
375
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
17
 | 
         $self->STORE( $i, shift @new_elements );  | 
| 
376
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
377
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
378
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
23
 | 
     $self->unlock;  | 
| 
379
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
380
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
381
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # Return deleted section, or last element in scalar context.  | 
| 
382
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     ##  | 
| 
383
 | 
7
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
63
 | 
     return wantarray ? @old_elements : $old_elements[-1];  | 
| 
384
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
385
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
386
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # We don't need to populate it, yet.  | 
| 
387
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # It will be useful, though, when we split out HASH and ARRAY  | 
| 
388
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # Perl will call EXTEND() when the array is likely to grow.  | 
| 
389
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # We don't care, but include it because it gets called at times.  | 
| 
390
 | 
 
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
 
 | 
 sub EXTEND {}  | 
| 
391
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
392
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _copy_node {  | 
| 
393
 | 
23
 | 
 
 | 
 
 | 
  
23
  
 | 
 
 | 
43
 | 
     my $self = shift;  | 
| 
394
 | 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
39
 | 
     my ($db_temp) = @_;  | 
| 
395
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
396
 | 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
78
 | 
     my $length = $self->length();  | 
| 
397
 | 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
98
 | 
     for (my $index = 0; $index < $length; $index++) {  | 
| 
398
 | 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
137
 | 
         $self->_copy_value( \$db_temp->[$index], $self->get($index) );  | 
| 
399
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
400
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
401
 | 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
57
 | 
     return 1;  | 
| 
402
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
403
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
404
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _clear {  | 
| 
405
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
2
 | 
     my $self = shift;  | 
| 
406
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
407
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
     my $size = $self->FETCHSIZE;  | 
| 
408
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
     for my $key ( 0 .. $size - 1 ) {  | 
| 
409
 | 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
17
 | 
         $self->_engine->delete_key( $self, $key, $key );  | 
| 
410
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
411
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
     $self->STORESIZE( 0 );  | 
| 
412
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
413
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
     return;  | 
| 
414
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
415
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
416
 | 
46
 | 
 
 | 
 
 | 
  
46
  
 | 
  
1
  
 | 
2896
 | 
 sub length  { (shift)->FETCHSIZE(@_) }  | 
| 
417
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
1
  
 | 
10
 | 
 sub pop     { (shift)->POP(@_)       }  | 
| 
418
 | 
5
 | 
 
 | 
 
 | 
  
5
  
 | 
  
1
  
 | 
18
 | 
 sub push    { (shift)->PUSH(@_)      }  | 
| 
419
 | 
3
 | 
 
 | 
 
 | 
  
3
  
 | 
  
1
  
 | 
16
 | 
 sub unshift { (shift)->UNSHIFT(@_)   }  | 
| 
420
 | 
6
 | 
 
 | 
 
 | 
  
6
  
 | 
  
1
  
 | 
21
 | 
 sub splice  { (shift)->SPLICE(@_)    }  | 
| 
421
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
422
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # This must be last otherwise we have to qualify all other calls to shift  | 
| 
423
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # as calls to CORE::shift  | 
| 
424
 | 
2
 | 
 
 | 
 
 | 
  
2
  
 | 
  
1
  
 | 
11
 | 
 sub shift { (CORE::shift)->SHIFT(@_) }  | 
| 
425
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
426
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
427
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |