1Stone::Cursor(3)      User Contributed Perl Documentation     Stone::Cursor(3)
2
3
4

NAME

6       Stone::Cursor - Traverse tags and values of a Stone
7

SYNOPSIS

9        use Boulder::Store;
10       $store = Boulder::Store->new('./soccer_teams');
11
12        my $stone = $store->get(28);
13        $cursor = $stone->cursor;
14        while (my ($key,$value) = $cursor->each) {
15          print "$value: Go Bluejays!\n" if $key eq 'State' and $value eq 'Katonah';
16        }
17

DESCRIPTION

19       Boulder::Cursor is a utility class that allows you to create one or
20       more iterators across a Stone object.  This is used for traversing
21       large Stone objects in order to identify or modify portions of the
22       record.
23
24       CLASS METHODS
25
26Boulder::Cursor->new($stone)
27Return a new Boulder::Cursor over the specified Stone object.  This will
28return an error if the object is not a Stone or a descendent. This method is
29usually not called directly, but rather indirectly via the Stone cursor()
30method:
31
32  my $cursor = $stone->cursor;
33

OBJECT METHODS

35
36$cursor->each()
37Iterate over the attached Stone.  Each iteration will return a two-valued list
38consisting of a tag path and a value.  The tag path is of a form that can be
39used with Stone::index() (in fact, a cursor is used internally to implement
40the Stone::dump() method.  When the end of the Stone is reached, "each()" will
41return an empty list, after which it will start over again from the beginning.
42If you attempt to insert or delete from the stone while iterating over it, all
43attached cursors will reset to the beginnning.
44
45For example:
46
47        $cursor = $s->cursor;
48        while (($key,$value) = $cursor->each) {
49           print "$value: BOW WOW!\n" if $key=~/pet/;
50        }
51
52$cursor->reset()
53This resets the cursor back to the beginning of the associated Stone.
54

AUTHOR

56       Lincoln D. Stein <lstein@cshl.org>.
57
59       Copyright 1997-1999, Cold Spring Harbor Laboratory, Cold Spring Harbor
60       NY.  This module can be used and distributed on the same terms as Perl
61       itself.
62

SEE ALSO

64       Boulder, Stone
65
66
67
68perl v5.8.8                       2000-06-08                  Stone::Cursor(3)
Impressum