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