| Previous | Next
Tie::Array, Tie::StdArrayProvides methods for array-tying classes. (See the perltie manpage for the functions needed for tying an array to a package.) The basic Tie::Array package provides stub DELETE and EXTEND methods and implements PUSH, POP, SHIFT, UNSHIFT, SPLICE, and CLEAR in terms of basic FETCH, STORE, FETCHSIZE, and STORESIZE. Tie::StdArray inherits from Tie::Array and provides the methods needed for tied arrays implemented as blessed references to an "inner" Perl array. It causes tied arrays to behave like standard arrays, allowing for selective method overloading. See the perltie manpage for more detailed information and for examples. To write your own tied arrays, use the following required methods.
TIEARRAY classname, list Constructor. This method is invoked by the command
CLEAR this Clears all values from the tied array associated with object
DESTROY this Normal object destructor.
EXTEND this, count Doesn't need to do anything. Provides information that the array will likely grow to have
FETCH this, index Retrieves the data item in index for the tied array associated with object
FETCHSIZE this Returns the number of items in the tied array associated with object
POP this Removes the last element from the array and returns it.
PUSH this, list Appends elements of list to the array.
SHIFT this Removes and returns the first element of the array, shifting the remaining elements down.
SPLICE this, offset, length, list Performs the equivalent of a splice on the array. Returns a list of the original
STORE this, index, value Stores value of a data item into index for the tied array associated with object
STORESIZE this, count Sets the total number of items in the tied array associated with object
UNSHIFT this, list Inserts list elements at the beginning of the array, moving existing elements up to make room. |