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