Debian Codegraph @

Debconf/Iterator.pm

raw
1 #!/usr/bin/perl
2
3 =head1 NAME
4
5 Debconf::Iterator - DebConf iterator object
6
7 =cut
8
9 package Debconf::Iterator;
10 use warnings;
11 use strict;
12 use base qw(Debconf::Base);
13
14 =head1 DESCRIPTION
15
16 This is an iterator object, for use by the DbDriver mainly. Use this object
17 just as you would use anything else derived from Debconf::Base.
18
19 =head1 FIELDS
20
21 Generally any you want. By convention prefix any field names you use with
22 your module's name, to prevent conflicts when multiple modules need to use
23 the same iterator.
24
25 =over 4
26
27 =item callback
28
29 A subroutine reference, this subroutine will be called each time the
30 iterator iterates, and should return the next item in the sequence or
31 undef.
32
33 =back
34
35 =head1 METHODS
36
37 =item iterate
38
39 Iterate to and return the next item, or undef when done.
40
41 =cut
42
43 sub iterate {
44 my $this=shift;
45
46 $this->callback->($this);
47 }
48
49 =head1 AUTHOR
50
51 Joey Hess <[email protected]>
52
53 =cut
54
55 1