MooseX::Iterator::Locate -- read "locate" database with MooseX::Iterator
use MooseX::Iterator::Locate; my $it = MooseX::Iterator::Locate->new; while ($it->has_next) { print $it->next, "\n"; }
MooseX::Iterator::Locate is a subclass of Moose::Object and File::Iterator::Locate,
MooseX::Iterator::Locate
Moose::Object
File::Iterator::Locate
Moose::Object File::Iterator::Locate MooseX::Iterator::Locate
and has roles
MooseX::Iterator::Role
MooseX::Iterator::Locate reads a "locate" database file in the style of MooseX::Iterator. It allows MooseX::Iterator features to be applied to database entries read by an underlying File::Locate::Iterator.
MooseX::Iterator
See examples/moosex-iterator.pl for a complete sample program.
$it = MooseX::Iterator::Locate->new (key=>value,...)
Create and return a new MooseX::Iterator::Locate object. Optional key/value pairs are passed to File::Locate::Iterator->new().
File::Locate::Iterator->new()
my $it = MooseX::Iterator::Locate->new (suffixes => ['.pm', '.pl']);
$entry = $it->next()
Return the next entry from the database. The first call is the first entry.
$entry = $it->peek()
Return the next entry from the database, but don't advance the iterator position. This is what $it->next() would return.
$it->next()
(This is not the same as peek in the base MooseX::Iterator version 0.11, which gives the second next item. Believe that's a mistake there, though the intention will be to follow what the base does when resolved.)
peek
$bool = $it->has_next()
Return true if there's a next entry available.
$it->reset()
Move $it back to the start of the database again. The next call to $it->next gives the first entry again.
$it
$it->next
As discussed in File::Locate::Iterator under rewind(), this reset is only possible when the underlying database file or handle is seekable.
rewind()
The various parameters accepted by new are attributes. They're all "bare" create-only, no getters or setters.
new
database_file Str database_fh FileHandle database_str Str suffix Str suffixes ArrayRef[Str] glob Str globs ArrayRef[Str] regexp Str | RegexpRef regexps ArrayRef[Str|RegexpRef] use_mmap enum (type MooseX::Iterator::Locate::UseMmap) "default", "if_sensible", "if_possible", "0", "1"
database_file default is File::Locate::Iterator->default_database_file(), and is in the form of a coderef default since default_database_file() looks at %ENV.
database_file
File::Locate::Iterator->default_database_file()
default_database_file()
%ENV
MooseX::Iterator, File::Locate::Iterator, Moose, Moose::Object
Moose::Manual::Roles
http://user42.tuxfamily.org/file-locate-iterator/index.html
Copyright 2010, 2011, 2014, 2017, 2018, 2019 Kevin Ryde
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. If not, see http://www.gnu.org/licenses/
To install File::Locate::Iterator, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Locate::Iterator
CPAN shell
perl -MCPAN -e shell install File::Locate::Iterator
For more information on module installation, please visit the detailed CPAN module installation guide.