NAME
XAS::Lib::Mixins::Iterator - A mixin for the XAS environment
SYNOPSIS
use XAS::Class;
version => '0.01',
base => 'XAS::Base',
mixin => 'XAS::Lib::Mixins::Iterator',
accessors => 'cfg'
;
sub init {
my $class = shift;
my $self = $class->SUPER::init(@_);
$self->init_iterator('cfg');
return $self;
}
DESCRIPTION
This is a general purpose iterator mixin. It is for handling an array of objects. It inserts the following items into the current object.
__position
__table
Which are used for bookkeeping.
METHODS
init_iterator($table)
This method initializes the iterator. It takes an option parameter. This parameter defaults to the value of 'table'.
items
This method returns all of the items in the table.
first
This method returns the first item from the table.
next
This method returns the next item from the table or undef if at the end of the table.
prev
This method returns the previous item from the table or undef if at the beginning of the table.
last
This method returns the last item from the table.
size
Return the number of items in the table.
position
Set the current position in the table.
SEE ALSO
AUTHOR
Kevin L. Esteb, <kevin@kesteb.us>
COPYRIGHT AND LICENSE
Copyright (C) 2014 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.