.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\" ========================================================================
.de Sh \" Subsection heading
.de Sp \" Vertical space (when we can't use .PP)
.de Vb \" Begin verbatim text
.de Ve \" End verbatim text
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
. tm Index:\\$1\t\\n%\t"\\$2"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. \" simple accents for nroff and troff
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
.\" ========================================================================
.TH Tie::Array 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
Tie::Array \- base class for tied arrays
\& package Tie::NewArray;
\& @ISA = ('Tie::Array');
\& 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
\& package Tie::NewStdArray;
\& @ISA = ('Tie::StdArray');
\& # all methods provided by default
\& $object = tie @somearray,Tie::NewArray;
\& $object = tie @somearray,Tie::StdArray;
\& $object = tie @somearray,Tie::NewStdArray;
This 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 \fBTie::Array\fR package provides stub \f(CW\*(C`DESTROY\*(C'\fR,
and \f(CW\*(C`EXTEND\*(C'\fR methods that do nothing, stub \f(CW\*(C`DELETE\*(C'\fR and \f(CW\*(C`EXISTS\*(C'\fR
methods that \fIcroak()\fR if the \fIdelete()\fR or \fIexists()\fR builtins are ever called
on the tied array, and implementations of \f(CW\*(C`PUSH\*(C'\fR, \f(CW\*(C`POP\*(C'\fR, \f(CW\*(C`SHIFT\*(C'\fR,
\&\f(CW\*(C`UNSHIFT\*(C'\fR, \f(CW\*(C`SPLICE\*(C'\fR and \f(CW\*(C`CLEAR\*(C'\fR in terms of basic \f(CW\*(C`FETCH\*(C'\fR, \f(CW\*(C`STORE\*(C'\fR,
\&\f(CW\*(C`FETCHSIZE\*(C'\fR, \f(CW\*(C`STORESIZE\*(C'\fR.
The \fBTie::StdArray\fR package provides efficient methods required for tied arrays
which are implemented as blessed references to an \*(L"inner\*(R" perl array.
It inherits from \fBTie::Array\fR, 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:
.IP "\s-1TIEARRAY\s0 classname, \s-1LIST\s0" 4
.IX Item "TIEARRAY classname, LIST"
The class method is invoked by the command \f(CW\*(C`tie @array, classname\*(C'\fR. Associates
an array instance with the specified class. \f(CW\*(C`LIST\*(C'\fR would represent
additional arguments (along the lines of AnyDBM_File and compatriots) needed
to complete the association. The method should return an object of a class which
provides the methods below.
.IP "\s-1STORE\s0 this, index, value" 4
.IX Item "STORE this, index, value"
Store datum \fIvalue\fR into \fIindex\fR for the tied array associated with
object \fIthis\fR. If this makes the array larger then
class's mapping of \f(CW\*(C`undef\*(C'\fR should be returned for new positions.
.IP "\s-1FETCH\s0 this, index" 4
.IX Item "FETCH this, index"
Retrieve the datum in \fIindex\fR for the tied array associated with
.IP "\s-1FETCHSIZE\s0 this" 4
.IX Item "FETCHSIZE this"
Returns the total number of items in the tied array associated with
object \fIthis\fR. (Equivalent to \f(CW\*(C`scalar(@array)\*(C'\fR).
.IP "\s-1STORESIZE\s0 this, count" 4
.IX Item "STORESIZE this, count"
Sets the total number of items in the tied array associated with
object \fIthis\fR to be \fIcount\fR. If this makes the array larger then
class's mapping of \f(CW\*(C`undef\*(C'\fR should be returned for new positions.
If the array becomes smaller then entries beyond count should be
.IP "\s-1EXTEND\s0 this, count" 4
.IX Item "EXTEND this, count"
Informative call that array is likely to grow to have \fIcount\fR entries.
Can be used to optimize allocation. This method need do nothing.
.IP "\s-1EXISTS\s0 this, key" 4
.IX Item "EXISTS this, key"
Verify that the element at index \fIkey\fR exists in the tied array \fIthis\fR.
The \fBTie::Array\fR implementation is a stub that simply croaks.
.IP "\s-1DELETE\s0 this, key" 4
.IX Item "DELETE this, key"
Delete the element at index \fIkey\fR from the tied array \fIthis\fR.
The \fBTie::Array\fR implementation is a stub that simply croaks.
.IP "\s-1CLEAR\s0 this" 4
Clear (remove, delete, ...) all values from the tied array associated with
.IP "\s-1DESTROY\s0 this" 4
Normal object destructor method.
.IP "\s-1PUSH\s0 this, \s-1LIST\s0" 4
.IX Item "PUSH this, LIST"
Append elements of \s-1LIST\s0 to the array.
Remove last element of the array and return it.
.IP "\s-1SHIFT\s0 this" 4
Remove the first element of the array (shifting other elements down)
.IP "\s-1UNSHIFT\s0 this, \s-1LIST\s0" 4
.IX Item "UNSHIFT this, LIST"
Insert \s-1LIST\s0 elements at the beginning of the array, moving existing elements
.IP "\s-1SPLICE\s0 this, offset, length, \s-1LIST\s0" 4
.IX Item "SPLICE this, offset, length, LIST"
Perform the equivalent of \f(CW\*(C`splice\*(C'\fR on the array.
\&\fIoffset\fR is optional and defaults to zero, negative values count back
from the end of the array.
\&\fIlength\fR is optional and defaults to rest of the array.
\&\fI\s-1LIST\s0\fR may be empty.
Returns a list of the original \fIlength\fR elements at \fIoffset\fR.
There is no support at present for tied \f(CW@ISA\fR. There is a potential conflict
between magic entries needed to notice setting of \f(CW@ISA\fR, and those needed to
Very little consideration has been given to the behaviour of tied arrays
when \f(CW$[\fR is not default value of zero.
Nick Ing-Simmons <nik@tiuk.ti.com>