Copyright (C) 2000-2012 |
Manpages Tie::ArraySection: Perl Programmers Reference Guide (3perl)Updated: 2001-02-22 Index Return to Main Contents NAMETie::Array - base class for tied arraysSYNOPSISpackage NewArray; use Tie::Array; @ISA = ('Tie::Array'); # mandatory methods sub TIEARRAY { ... } sub FETCH { ... } sub FETCHSIZE { ... } sub STORE { ... } # mandatory if elements writeable sub STORESIZE { ... } # mandatory if elements can be added/deleted sub EXISTS { ... } # mandatory if exists() expected to work sub DELETE { ... } # mandatory if delete() expected to work # optional methods - for efficiency sub CLEAR { ... } sub PUSH { ... } sub POP { ... } sub SHIFT { ... } sub UNSHIFT { ... } sub SPLICE { ... } sub EXTEND { ... } sub DESTROY { ... } package NewStdArray; use Tie::Array; @ISA = ('Tie::StdArray'); # all methods provided by default package main; $object = tie @somearray,Tie::NewArray; $object = tie @somearray,Tie::StdArray; $object = tie @somearray,Tie::NewStdArray; DESCRIPTIONThis module provides methods for array-tying classes. See perltie for a list of the functions required in order to tie an array to a package. The basic Tie::Array package provides stub "DESTROY", and "EXTEND" methods that do nothing, stub "DELETE" and "EXISTS" methods that croak() if the delete() or exists() builtins are ever called on the tied array, and implementations of "PUSH", "POP", "SHIFT", "UNSHIFT", "SPLICE" and "CLEAR" in terms of basic "FETCH", "STORE", "FETCHSIZE", "STORESIZE".The Tie::StdArray package provides efficient methods required for tied arrays which are implemented as blessed references to an ``inner'' perl array. It inherits from Tie::Array, and should cause tied arrays to behave exactly like standard arrays, allowing for selective overloading of methods. For developers wishing to write their own tied arrays, the required methods are briefly defined below. See the perltie section for more detailed descriptive, as well as example code:
CAVEATSThere is no support at present for tied @ISA. There is a potential conflict between magic entries needed to notice setting of @ISA, and those needed to implement 'tie'.Very little consideration has been given to the behaviour of tied arrays when $[ is not default value of zero. AUTHORNick Ing-Simmons <nik@tiuk.ti.com>
IndexThis document was created by man2html, using the manual pages. Time: 14:37:25 GMT, April 26, 2024 |