Tie::Array::Lazier - Lazier than Tie::Array::Lazy


Tie-Array-Lazy documentation  | view source Contained in the Tie-Array-Lazy distribution.

Index


NAME

Top

Tie::Array::Lazier - Lazier than Tie::Array::Lazy

VERSION

Top

$Id: Lazier.pm,v 0.1 2007/05/26 17:54:19 dankogai Exp dankogai $

SYNOPSIS

Top

  use Tie::Array::Laier;
  # 0..Inf
  tie my @a, 'Tie::Array::Laier', [], sub{ $_[1] };
  $a[3] = 'three'; # $self->array is [undef, undef, undef, 'three']
  print "$_\n" for @a; # 0, 1, 2, 'three', 4 ...

DESCRIPTION

Top

Tie::Array::Lazier is a child class of Tie::Array::Lazy that behaves a lot like its parent except for one thing; It is even lazier.

Instead of filling elements up to $index, Tie::Array::Lazier It calls $self->maker when $self->array->[$index] is undef. Therefore you cannot store undef to the tied array.

EXPORT

Top

None.

FUNCTIONS

Top

Same as Tie::Array::Lazy.

note on $_[0]->index vs $_[1]

While $_[0]->index is identical to $_[1] in Tie::Array::Lazy>, these values may disagree in Tie::Array::Lazier Whenever you need the index, use $_[1].

  # 0..Inf
  tie my @a, 'Tie::Array::Lazier', [], sub{ $_[0]->index }; # wrong!
  tie my @a, 'Tie::Array::Lazier', [], sub{ $_[1] };        # right!

You can still use $_[0]->index to find how many elements the internal array holds.

AUTHOR

Top

Dan Kogai, <dankogai at dan.co.jp>

BUGS

Top

See Tie::Array::Lazy.

SUPPORT

Top

See Tie::Array::Lazy.

ACKNOWLEDGEMENTS

Top

See Tie::Array::Lazy.

COPYRIGHT & LICENSE

Top


Tie-Array-Lazy documentation  | view source Contained in the Tie-Array-Lazy distribution.