John Douglas Porter > Tie-OffsetArray-0.01 > Tie::OffsetArray

Download:
Tie-OffsetArray-0.01.tar.gz

Dependencies

Annotate this POD (1)

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Tie::OffsetArray - Tie one array to another, with index offset

SYNOPSIS ^

  use Tie::OffsetArray;

  tie @a, 'Tie::OffsetArray', 1, \@b; # offset=1; use given array.

  tie @c, 'Tie::OffsetArray', 2;      # use anonymous array.

  $a[0] = 'x';                        # assign to $b[1];

  tied(@a)->array->[0] = 'y';         # assign to $b[0].

DESCRIPTION ^

When tied to this class, an array's behavior is completely normal. For its internal storage, it uses another array, either one supplied by the caller, or a new anonymous one. Accesses to the tied array are mapped down to the storage array by offsetting the index by some constant amount.

A special method on the tied object returns a reference to the storage array, so that the elements below the offset can be accessed. This is particularly useful if the storage array was not supplied by the caller.

AUTHOR ^

jdporter@min.net (John Porter)

COPYRIGHT ^

This is free software. This software may be modified and distributed under the same terms as Perl itself.

syntax highlighting: