| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Array::Iterator::Reusable; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
193447
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
9
|
|
|
|
1
|
|
|
|
|
67
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
621
|
use Array::Iterator; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
129
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# AUTHORITY |
|
10
|
|
|
|
|
|
|
# DATE |
|
11
|
|
|
|
|
|
|
# DIST |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.135 |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.135'; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @ISA = qw(Array::Iterator); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub reset { |
|
24
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
|
25
|
1
|
|
|
|
|
10
|
$self->_iterated = 0; |
|
26
|
1
|
|
|
|
|
7
|
$self->_current_index = 0; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
|
30
|
|
|
|
|
|
|
#ABSTRACT: A subclass of Array::Iterator to allow reuse of iterators |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=for Pod::Coverage .+ |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Array::Iterator::Reusable; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# create an iterator with an array |
|
39
|
|
|
|
|
|
|
my $i = Array::Iterator::Reusable->new(1 .. 100); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# do something with the iterator |
|
42
|
|
|
|
|
|
|
my @accumulation; |
|
43
|
|
|
|
|
|
|
push @accumulation => { item => $iterator->next() } while $iterator->has_next(); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# now reset the iterator so we can do it again |
|
46
|
|
|
|
|
|
|
$iterator->reset(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Sometimes you don't want to have to throw out your iterator each time you have exhausted it. This class adds the C method to allow reuse of an iterator. This is a very simple addition to the Array::Iterator class of a single method. |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This is a subclass of Array::Iterator, only those methods that have been added are documented here, refer to the Array::Iterator documentation for more information. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This resets the internal counter of the iterator back to the start of the array. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=back |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is a subclass of B, please refer to it for more documentation. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 ORIGINAL AUTHOR |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
stevan little, Estevan@iinteractive.comE |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 ORIGINAL COPYRIGHT AND LICENSE |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Copyright 2004 by Infinity Interactive, Inc. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
79
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |