Alzabo...Cursor(3pm)
๐ Alzabo::Runtime::RowCursor โ the 3pm page, but make it cute ๐
okay bestie, so this is the manual page for Alzabo::Runtime::RowCursor from the User Contributed Perl Documentation collection, and no cap, it's actually kinda iconic. sit down, grab a strawberry ๐, and let's get into it.
โจ NAME โจ
Alzabo::Runtime::RowCursor โ it's a cursor that hands you back Alzabo::Runtime::Row objects ๐
Like, that's literally its whole job. A cursor. For rows. Row cursor. The name ate fr fr.
๐ธ SYNOPSIS ๐ธ
here's the vibe in code form, copy it exactly bestie:
use Alzabo::Runtime::RowCursor;
my $cursor = $schema->table('foo')->all_rows;
while ( my $row = $cursor->next )
{
print $row->select('foo'), "\n";
}
see how we're just looping? next keeps giving you rows until it gives you undef and the while bails out. chef's kiss. ๐
๐ฆ DESCRIPTION ๐ฆ
so, objects in this class exist to return Alzabo::Runtime::Row objects for your queries. that's the assignment. ๐
and here's the part that's lowkey genius: the cursor does NOT preload objects. it creates them on demand, which is much more efficient. it's giving "why make 500 rows when you might only need 3" energy. main character resource management honestly.
if you want the whole deep dive on why this is the move, go read the RATIONALE FOR CURSORS section over in Alzabo::Design. iykyk.
๐ INHERITS FROM ๐
Alzabo::Runtime::Cursor โ yeah she got it from her mama. ๐
๐ METHODS ๐
next
returns the next Alzabo::Runtime::Row object, or undef if there are no more available. that undef is the "we're done here" signal, so don't sleep on checking for it.
all_rows
returns all the rows available from the current point onwards. โญ
and this is the important little detail bestie, pay attention: it means that if there are five rows that will be returned when the object is created, and you call next twice, then calling all_rows after that will only return three. the cursor remembers where it's at. no rewinding, no do-overs.
reset
resets the cursor so that the next next call will return the first row of the set. it's the little rewind button. ๐โจ
count
returns the number of rows returned by the cursor so far. so far!! not the total!! she's counting what she's already handed you. ๐งฎ
next_as_hash
returns the next row as a hash, where the hash key is the table name and the hash value is the row object. cute little key-value packaging, obsessed. ๐
๐ซถ AUTHOR ๐ซถ
Dave Rolsky, <autarch@urth.org> โ thank you for your service king ๐
heads up bestie: that email address goes in exactly as written, autarch@urth.org, no edits, no autocorrect, we respect the author. ๐
okay that's the whole page, you understood all of it, slay. ๐โจ
perl v5.34.0, dated 2022-06-14 โ and that's the footer, so mwah, thanks for reading, go forth and iterate responsibly ๐ฆ๐๐ธ
๐ฆ where this page comes from
- debian bookworm: libalzabo-perl 0.92-6 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libalzabo-perl 0.92-6 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libalzabo-perl 0.92-6 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalzabo-perl 0.92-6 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalzabo-perl 0.92-6 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms