NAME
Valiant::HTML::Util::Collection - A utility class for creating collections of items.
SYNOPSIS
use Valiant::HTML::Util::Collection;
my $collection = Valiant::HTML::Util::Collection->new(@items);
while(my $item = $collection->next) {
# do something with $item
}
$collection->reset;
my $size = $collection->size;
DESCRIPTION
Valiant::HTML::Util::Collection is a utility class for creating collections of items. The collection can contain any type of item, but each item is represented as a LValiant::HTML::Util::Collection::Item object.
METHODS
- new(@items)
-
Constructs a new Valiant::HTML::Util::Collection object with the provided items. Each item can be any type of scalar value, or an object that has been blessed into the Valiant::HTML::Util::Collection::Item package.
- next
-
Returns the next item in the collection, or undef if there are no more items. The current position within the collection is advanced by one.
- build
-
Constructs a new Valiant::HTML::Util::Collection::Item object from the provided arguments. The first argument is the label, and the second argument is the value.
- current_index
-
Returns the current position within the collection.
- current_item
-
Returns the current item in the collection.
- size
-
Returns the size of the collection.
- reset
-
Resets the current position within the collection to the beginning.
- all
-
Returns all of the items in the collection as a list.
SEE ALSO
Valiant, Valiant::HTML::SafeString, Valiant::HTML::FormBuilder
AUTHOR
See Valiant
COPYRIGHT & LICENSE
See Valiant