Stone::Cursor - Traverse tags and values of a Stone |
Stone::Cursor - Traverse tags and values of a Stone
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'; }
Boulder::Cursor is a utility class that allows you to create one or more iterators across a Stone object. This is used for traversing large Stone objects in order to identify or modify portions of the record.
new($stone)
cursor()
method:
my $cursor = $stone->cursor;
each()
each()
will return an empty list,
after which it will start over again from the beginning. If you
attempt to insert or delete from the stone while iterating over it,
all attached cursors will reset to the beginnning.
For example:
$cursor = $s->cursor; while (($key,$value) = $cursor->each) { print "$value: BOW WOW!\n" if $key=~/pet/; }
reset()
Lincoln D. Stein <lstein@cshl.org>.
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.
Boulder, Stone
Stone::Cursor - Traverse tags and values of a Stone |