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
}
return $self->{ARRAY}[$idx] = $value;
}
+
+Negative indexes are treated the same as with FETCH.
=item DESTROY this
=head2 Tying Hashes
-As the first Perl data type to be tied (see dbmopen()), hashes have the
-most complete and useful tie() implementation. A class implementing a
-tied hash should define the following methods: TIEHASH is the constructor.
-FETCH and STORE access the key and value pairs. EXISTS reports whether a
-key is present in the hash, and DELETE deletes one. CLEAR empties the
-hash by deleting all the key and value pairs. FIRSTKEY and NEXTKEY
-implement the keys() and each() functions to iterate over all the keys.
-And DESTROY is called when the tied variable is garbage collected.
+Hashes were the first Perl data type to be tied (see dbmopen()). A class
+implementing a tied hash should define the following methods: TIEHASH is
+the constructor. FETCH and STORE access the key and value pairs. EXISTS
+reports whether a key is present in the hash, and DELETE deletes one.
+CLEAR empties the hash by deleting all the key and value pairs. FIRSTKEY
+and NEXTKEY implement the keys() and each() functions to iterate over all
+the keys. And DESTROY is called when the tied variable is garbage
+collected.
If this seems like a lot, then feel free to inherit from merely the
standard Tie::Hash module for most of your methods, redefining only the