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

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

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 ...

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.

None.

Same as Tie::Array::Lazy.
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.

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

See Tie::Array::Lazy.

See Tie::Array::Lazy.

See Tie::Array::Lazy.

Copyright 2007 Dan Kogai, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.