1Stone::Cursor(3) User Contributed Perl Documentation Stone::Cursor(3)
2
3
4
6 Stone::Cursor - Traverse tags and values of a Stone
7
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
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 Boulder::Cursor->new($stone)
26 Return a new Boulder::Cursor over the specified Stone object. This
27 will return an error if the object is not a Stone or a descendent.
28 This method is usually not called directly, but rather indirectly
29 via the Stone cursor() method:
30
31 my $cursor = $stone->cursor;
32
33 OBJECT METHODS
34 $cursor->each()
35 Iterate over the attached Stone. Each iteration will return a two-
36 valued list consisting of a tag path and a value. The tag path is
37 of a form that can be used with Stone::index() (in fact, a cursor
38 is used internally to implement the Stone::dump() method. When the
39 end of the Stone is reached, "each()" will return an empty list,
40 after which it will start over again from the beginning. If you
41 attempt to insert or delete from the stone while iterating over it,
42 all attached cursors will reset to the beginnning.
43
44 For example:
45
46 $cursor = $s->cursor;
47 while (($key,$value) = $cursor->each) {
48 print "$value: BOW WOW!\n" if $key=~/pet/;
49 }
50
51 $cursor->reset()
52 This resets the cursor back to the beginning of the associated
53 Stone.
54
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
64 Boulder, Stone
65
67 Hey! The above document had some coding errors, which are explained
68 below:
69
70 Around line 28:
71 '=item' outside of any '=over'
72
73 Around line 37:
74 You forgot a '=back' before '=head2'
75
76 Around line 39:
77 '=item' outside of any '=over'
78
79 Around line 62:
80 You forgot a '=back' before '=head1'
81
82
83
84perl v5.28.0 1999-11-30 Stone::Cursor(3)