NAME
DBIx::Squirrel::Context - what a stage can ask about the result it's making
SYNOPSIS
use DBIx::Squirrel::Context qw(result_number result_original);
my $it = $dbh->iterate(
'SELECT name FROM artist ORDER BY name',
sub ($row) { "@{[ result_number ]}. $row->[0]" },
);
DESCRIPTION
Inside a stage run by a DBIx::Squirrel::Iterator, these functions return what the stage might want to know about the result it's making, which it can't work out from the value it's given. Outside a stage, they return undef. None is exported by default.
FUNCTIONS
iterator
The iterator running the stage. Its sth is the statement handle, and the statement handle's Database, the database handle.
result_number
The number of the result being made, from 1. It counts results, not rows: while a stage drops rows, the number stays the same, and each value a stage returns in place of one row is a result of its own. In an end function of a stage made with DBIx::Squirrel::Gather, it's the number of the first value the end returns.
result_original
The row the result is being made from, as it was fetched, before any stage changed it. In an end function of a stage made with DBIx::Squirrel::Gather, and the stages after it, it's undef, as what an end gives comes from every row.
within
For DBIx::Squirrel's iterators, which set the context while their stages run; not for use elsewhere.
SEE ALSO
DBIx::Squirrel::Iterator, DBIx::Squirrel::Pipeline
AUTHOR
Iain Campbell <cpanic@cpan.org>
LICENSE
Copyright (c) 2024-2026 by Iain Campbell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.