This file is indexed.

/usr/share/perl5/Class/DBI/Lite/Iterator.pm is in libclass-dbi-lite-perl 1.026-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package Class::DBI::Lite::Iterator;

use strict;
use warnings 'all';


sub new
{
  my ($class, $data) = @_;
  
  my $s = bless {
    data  => $data,
    count => scalar(@$data),
    idx   => 0
  }, $class;
  $s->init();
  
  return $s;
}# end new()


sub init { }


sub first
{
  return unless $_[0]->{data}->[0];
  $_[0]->{data}->[0];
}# end first()


sub next
{
  my $s = shift;
  return unless $s->{idx} < $s->{count};
  $s->{data}->[ $s->{idx}++ ];
}# end next()


sub count
{
  $_[0]->{count};
}# end count()


sub reset
{
  $_[0]->{idx} = 0;
}# end reset()

1;# return true:


=pod

=head1 NAME

Class::DBI::Lite::Iterator - Simple iterator for Class::DBI::Lite

=head1 SYNOPSIS

  # Get an iterator somehow:
  my $iter = app::artist->retrieve_all;
  
  my $artist = $iter->first;
  
  my $record_count = $iter->count;
  
  while( my $artist = $iter->next )
  {
    ...
  }# end while()
  
  # We can reset the iterator to go back to the beginning:
  $iter->reset;
  print $_->id . "\n" while $_ = $iter->next;

=head1 DESCRIPTION

Provides a simple iterator-based approach to Class::DBI::Lite resultsets.

=head1 PUBLIC PROPERTIES

=head2 count

Returns the number of records in the Iterator.

=head1 PUBLIC METHODS

=head2 next

Returns the next object in the series, or undef.

Moves the internal cursor to the next object if one exists.

=head2 reset

Resets the internal cursor to the first object if one exists.

=head1 SEE ALSO

L<Class::DBI:Lite>

=head1 AUTHOR

John Drago <jdrago_999@yahoo.com>.

=head1 LICENSE AND COPYRIGHT

Copyright 2008 John Drago <jdrago_999@yahoo.com>.  All rights reserved.

This software is Free software and may be used and distributed under the same 
terms as perl itself.

=cut