None available.
sub _sort
{ my ($self, $sort_by) = @_;
$self->throw("Generic iterator cannot sort ".ref($self).
" object by '$sort_by'."); } |
sub new
{ my ($caller, $arrayref, $sort_by, $reverse) = @_;
my $class = ref $caller || $caller;
my $self;
if ($arrayref) {
$self = bless { _orig_array_ref => [ @$arrayref ],
_iterator_array_ref => [ @$arrayref ],
_sort_by => ($sort_by || undef),
_reverse => ($reverse || 0)
},
$class;
}
else {
croak("No valid array ref for Iterator of ".
(ref($class) || $class)." provided:");
}
$self->_sort() if $sort_by;
$self->_reverse() if $reverse;
return $self; } |
sub reset
{ my ($self) = @_;
@{$self->{_iterator_array_ref}} = @{$self->{_orig_array_ref}};
$self->_sort() if $self->{'_sort_by'};
$self->_reverse() if $self->{'reverse'};
return $self; } |