DBIx::QueryByName::Result::HashIterator - A hash iterator around a statement handle
Provides an iterator-like api to a DBI statement handle that is expected to return one or more columns upon each call to fetchrow_array().
DO NOT USE DIRECTLY!
my $i = new($query,$sth);
Return a hash iterator wrapped around this statement handle.
my $result = $i->next();
or
my $result = $i->next($col1, $col2...);
If next is called with no arguments, it returns the query's result as a hashref (just as fetchrow_hash would) or undef if there are no more rows to fetch.
next
fetchrow_hash
Example:
# call query GetJobs that returns an iterator on which # we call next directly. The query returns a hash with # two keys 'id' and 'name' my $v = $dbh->GetJobs->next; my $id = $v->{id}; my $name = $v->{name};
If next is called a list of column names in arguments, it returns the query's result as a list of the corresponding hashref's values for those columns, or undef if there are no more rows to fetch.
# same as previous example, just more concise: my ($id,$name) = $dbh->GetJobs->next('id','name');
To install DBIx::QueryByName, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::QueryByName
CPAN shell
perl -MCPAN -e shell install DBIx::QueryByName
For more information on module installation, please visit the detailed CPAN module installation guide.