NAME
Salvation::MacroProcessor::Iterator - An iterator for reading query results
DESCRIPTION
What is it?
Salvation::MacroProcessor::Iterator is an iterator class. It should be wrapped around your custom iterator and supplied some postfilter
ing function which will execute Salvation::MacroProcessor::MethodDescription::postfitler
routine.
Example usage
my $it = Salvation::MacroProcessor::Iterator -> new(
postfilter => $CodeRef,
iterator => $it
);
REQUIRES
METHODS
new
Salvation::MacroProcessor::Iterator -> new(
postfilter => $CodeRef,
iterator => $it
)
Constructor.
Returns Salvation::MacroProcessor::Iterator instance.
Arguments:
- postfilter
-
A CodeRef matching following signature:
( Any $object )
.
$object
is an object representing a single row of data returned by the query.$CodeRef
function will be executed for each row to check if this row is suitable as a result for caller, or not.Boolean value should be returned,
false
means "skip this object" andtrue
means "yes, this object is what we want".It is common to make
$CodeRef
look like that:sub { $spec -> __postfilter_each( shift ) }
, where
$spec
is a Salvation::MacroProcessor::Spec instance. - iterator
-
An Object that does Salvation::MacroProcessor::Iterator::Compliance role.
Salvation::MacroProcessor::Iterator will be wrapped around this object.
first
$object -> first()
Returns first element of a list.
last
$object -> last()
Returns last element of a list.
next
$object -> next()
Returns element at current position, then increases position by one.
prev
$object -> prev()
Returns element at current position, then decreases position by one.