Stefan Hornburg (Racke) > Data-Transpose-0.0006 > Data::Transpose::Iterator::Base

Download:
Data-Transpose-0.0006.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: Data-Transpose-0.0011

NAME ^

Data::Transpose::Iterator::Base - Iterator for Data::Transpose.

This iterator provides basic methods for iteration, like number of records (count) and getting next record (next).

SYNOPSIS ^

    $cart = [{isbn => '978-0-2016-1622-4',
              title => 'The Pragmatic Programmer',
              quantity => 1},
             {isbn => '978-1-4302-1833-3',
              title => 'Pro Git',
              quantity => 1},
            ];

    $iter = new Data::Transpose::Iterator::Base(records => $cart);

    print "Count: ", $iter->count, "\n";

    while ($record = $iter->next) {
            print "Title: ", $record->title(), "\n";
    }

    $iter->reset;

    $iter->seed({isbn => '978-0-9779201-5-0',
                 title => 'Modern Perl',
                 quantity => 10});

ATTRIBUTES ^

records

Creates a Data::Transpose::Iterator::Base object. The elements of the iterator are hash references. They can be passed to the constructor as array or array reference.

count

Number of elements (if supported).

index

Current position (starting from 0).

METHODS ^

next

Returns next record or undef.

reset

Resets iterator.

seed

Seeds iterator.

sort

Sorts records of the iterator.

Parameters are:

$sort

Field used for sorting.

$unique

Whether results should be unique (optional).

AUTHOR ^

Stefan Hornburg (Racke), <racke@linuxia.de>

LICENSE AND COPYRIGHT ^

Copyright 2010-2014 Stefan Hornburg (Racke) <racke@linuxia.de>.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: