Iterator::Locate - read "locate" database with Iterator


File-Locate-Iterator documentation Contained in the File-Locate-Iterator distribution.

Index


Code Index:

NAME

Top

Iterator::Locate -- read "locate" database with Iterator

SYNOPSIS

Top

 use Iterator::Locate;
 my $it = Iterator::Locate->new;
 until ($it->is_exhausted) {
   my $entry = $it->value;
   print $entry,"\n";
 }

CLASS HIERARCHY

Top

Iterator::Locate is a subclass of Iterator,

    Iterator
      Iterator::Locate

DESCRIPTION

Top

An Iterator::Locate object reads a "locate" database file in iterator style. It's a front-end to the File::Locate::Iterator module, allowing the various Iterator module features to be used for filtering or crunching entries from a locate database.

See examples/iterator-pm.pl in the File-Locate-Iterator sources for a simple complete program.

FUNCTIONS

Top

Creation

$it = Iterator::Locate->new (key=>value,...)

Create and return a new Iterator::Locate object. Optional key/value arguments are passed to File::Locate::Iterator->new.

SEE ALSO

Top

Iterator, File::Locate::Iterator

HOME PAGE

Top

http://user42.tuxfamily.org/file-locate-iterator/index.html

COPYRIGHT

Top


File-Locate-Iterator documentation Contained in the File-Locate-Iterator distribution.

# Copyright 2009, 2010, 2011 Kevin Ryde.
#
# This file is part of File-Locate-Iterator.
#
# File-Locate-Iterator is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# File-Locate-Iterator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with File-Locate-Iterator; see the file COPYING.  Failing that, go to
# <http://www.gnu.org/licenses/>.


package Iterator::Locate;
use 5.005;
use strict;
use warnings;
use File::Locate::Iterator;
use base 'Iterator';
use vars qw($VERSION);

$VERSION = 20;

sub new {
  my $class = shift;
  my $it = File::Locate::Iterator->new (@_);
  return $class->SUPER::new
    (sub {
       if (defined (my $entry = $it->next)) {
         return $entry;
       }
       Iterator::is_done();
     });
}

1;
__END__