Stone::Cursor(3pm)
β¨ Stone::Cursor β¨
okay bestie, welcome to the Stone::Cursor manual page, a.k.a. the User Contributed Perl Documentation page, and honestly? it's giving tiny-but-mighty π this is the little helper that lets you walk through a Stone one tag-and-value at a time, no cap.
πΈ NAME πΈ
Stone::Cursor β Traverse tags and values of a Stone π¦
π SYNOPSIS π
use Boulder::Store;
$store = Boulder::Store->new('./soccer_teams');
my $stone = $store->get(28);
$cursor = $stone->cursor;
while (my ($key,$value) = $cursor->each) {
print "$value: Go Bluejays!\n" if $key eq 'State' and $value eq 'Katonah';
}
likeβ¦β¦ look at her go π«Ά you grab a stone, you ask it for a cursor, you loop with each, and you print the thing when the key and value line up. iconic behavior fr fr.
π DESCRIPTION π
Boulder::Cursor is a utility class that lets you spin up one or more iterators across a Stone object. (and yes, bestie, the DESCRIPTION is out here calling itself Boulder::Cursor while the NAME says Stone::Cursor β that's just what the page says, we don't question the lore π)
what is it for? traversing large Stone objects so you can find the parts of the record you care about, or change them. it's the "walk the whole thing without losing your mind" tool. π§
π CLASS METHODS π
Boulder::Cursor->new($stone)β hands you a freshBoulder::Cursorsitting over the Stone object you passed in. if that object isn't a Stone, or a descendant of one? error time, bestie. π also, real talk: you're usually not calling this directly β you get here indirectly through the Stonecursor()method:
my $cursor = $stone->cursor;
π OBJECT METHODS π
$cursor->each()β iterates over the attached Stone. every iteration hands back a two-valued list: a tag path and a value. the tag path is in a form you can use withStone::index()β and in fact, a cursor is used internally to implement theStone::dump()method, so this thing is literally pulling its weight behind the scenes π when you hit the end of the Stone,each()returns an empty list, and after that it just starts over again from the beginning. no drama, it's a loop-de-loop. π
β οΈ heads up though: if you try to insert or delete from the stone while you're iterating over it, all attached cursors will reset to the beginnning. yes, all of them. no cap. don't do that to your cursors mid-loop π
for example:
$cursor = $s->cursor;
while (($key,$value) = $cursor->each) {
print "$value: BOW WOW!\n" if $key=~/pet/;
}
$cursor->reset()β rewinds the cursor all the way back to the beginning of the associated Stone. fresh start, main character energy, we love to see it π
π«Ά AUTHOR π«Ά
Lincoln D. Stein <lstein@cshl.org>. β¨
π COPYRIGHT π
Copyright 1997-1999, Cold Spring Harbor Laboratory, Cold Spring Harbor NY. This module can be used and distributed on the same terms as Perl itself. π
β SEE ALSO β
BoulderStone
and that's the whole page, bestie π
perl v5.34.0, dated 2022-06-08 β shoutout to the Stone::Cursor(3pm) footer for keeping us honest. go forth and traverse, you gorgeous iterator πΈπ¦β¨
π¦ where this page comes from
- debian bookworm: libboulder-perl 1.30-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libboulder-perl 1.30-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libboulder-perl 1.30-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libboulder-perl 1.30-6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libboulder-perl 1.30-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