From: Gurusamy Sarathy Date: Sun, 28 May 2000 08:50:32 +0000 (+0000) Subject: add note about the handling of negative indices to tied arrays X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0b931be4791f7d772317758feb118bd4d693a29e;p=p5sagit%2Fp5-mst-13.2.git add note about the handling of negative indices to tied arrays (from Michael G Schwern ) p4raw-id: //depot/perl@6138 --- diff --git a/pod/perltie.pod b/pod/perltie.pod index 95de3bb..49bf989 100644 --- a/pod/perltie.pod +++ b/pod/perltie.pod @@ -260,6 +260,10 @@ index whose value we're trying to fetch. return $self->{ARRAY}[$idx]; } +If a negative array index is used to read from an array, the index +will be translated to a positive one internally by calling FETCHSIZE +before being passed to FETCH. + As you may have noticed, the name of the FETCH method (et al.) is the same for all accesses, even though the constructors differ in names (TIESCALAR vs TIEARRAY). While in theory you could have the same class servicing @@ -281,6 +285,8 @@ there. For example: } return $self->{ARRAY}[$idx] = $value; } + +Negative indexes are treated the same as with FETCH. =item DESTROY this