Merged with master and am ready to merge back
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Iterator.pm
CommitLineData
f0276afb 1package DBM::Deep::Iterator;
2
3use 5.006_000;
4
5use strict;
6use warnings FATAL => 'all';
7
8=head1 NAME
9
10DBM::Deep::Iterator
11
12=head1 PURPOSE
13
1c62d370 14This is an internal-use-only object for L<DBM::Deep>. It is the iterator
f0276afb 15for FIRSTKEY() and NEXTKEY().
16
17=head1 OVERVIEW
18
19This object
20
21=head1 METHODS
22
23=head2 new(\%params)
24
25The constructor takes a hashref of params. The hashref is assumed to have the
26following elements:
27
28=over 4
29
1c62d370 30=item * engine (of type L<DBM::Deep::Engine>
f0276afb 31
32=item * base_offset (the base_offset of the invoking DBM::Deep object)
33
34=back
35
36=cut
37
38sub new {
39 my $class = shift;
40 my ($args) = @_;
41
42 my $self = bless {
f0276afb 43 engine => $args->{engine},
44 base_offset => $args->{base_offset},
45 }, $class;
46
47 Scalar::Util::weaken( $self->{engine} );
48
350896ee 49 $self->reset;
50
f0276afb 51 return $self;
52}
53
54=head2 reset()
55
56This method takes no arguments.
57
58It will reset the iterator so that it will start from the beginning again.
59
60This method returns nothing.
61
62=cut
63
350896ee 64sub reset { die "reset must be implemented in a child class" }
f0276afb 65
66=head2 get_next_key( $obj )
67
68=cut
69
19b913ce 70sub get_next_key { die "get_next_key must be implemented in a child class" }
f0276afb 71
721;
73__END__