File::Find::Object(3)
π File::Find::Object(3) π
okay so bestie, this is a User Contributed Perl Documentation page for File::Find::Object, and honestly? it ate. let's get into it π«Ά
β¨ NAME β¨
File::Find::Object β an object oriented File::Find replacement. yes, it's giving glow-up. π
π VERSION π
version 0.3.9 β iconic, current, no notes β¨
πΈ SYNOPSIS πΈ
like, here's the whole vibe in nine lines:
use File::Find::Object;
my $tree = File::Find::Object->new({}, @targets);
while (my $r = $tree->next()) {
print $r ."\n";
}
that's it. that's the whole mood. π¦
π¦ DESCRIPTION π¦
so File::Find::Object does the exact same job as File::Find, but it works like an object and with an iterator. literally the same job, better energy.
here's why the original File::Find was lowkey problematic:
File::Findis not object oriented, so you literally cannot run multiple searches in the same application. one search. that's the limit. π- the second problem is its file processing: after starting its main loop, you can't easily wait for another event and then get the next result. it's giving "no thoughts, head empty" β the loop just goes.
with File::Find::Object you can get the next file by calling the next() function, but setting a callback is still possible. best of both worlds, fr fr. π
β FUNCTIONS β
π new
my $ffo = File::Find::Object->new( { options }, @targets);
creates a new File::Find::Object object. @targets is the list of directories or files which the object should explore. give it places to go, bestie. πΊοΈ
π options
depthβ Boolean. returns the directory content before the directory itself. chaos-first ordering, we respect it.nocrossfsβ Boolean. doesn't continue on filesystems different than the parent. staying in its lane, love that for it.followlinkβ Boolean. follow symlinks when they point to a directory.
π good news: you can safely set this option to true, because File::Find::Object does not follow the link if it detects a loop. self-aware king behavior.
filterβ Function reference. should point to a function returning TRUE or FALSE. this function is called with the filename to filter, and if the function returns FALSE, the file is skipped. gatekeeping, but make it functional. πcallbackβ Function reference. should point to a function which would be called each time a new file is returned. the function is called with the current filename as an argument. like a little notification every time something new shows up. π
π next
returns the next file found by the File::Find::Object. it returns undef once the scan is completed. so like, undef is the "we're done here" text. π
π item
returns the current filename found by the File::Find::Object object β i.e: the last value returned by next(). it's the "wait what were we just talking about" of methods. π
π next_obj
like next() only it returns the result as a convenient File::Find::Object::Result object. "$ff->next()" is equivalent to "$ff->next_obj()->path()". glow-up in object form. β¨
π item_obj
like item() only it returns the result as a convenient File::Find::Object::Result object. "$ff->item()" is equivalent to "$ff->item_obj()->path()". same energy, fancier wrapper. π
π $ff->set_traverse_to([@children])
sets the children to traverse to from the current node. useful for pruning items to traverse β like uninviting people from the group chat, but for directory nodes. π
accepts a single array reference.
example:
$ff->set_traverse_to([ grep { ! /\A\./ } @{ $ff->get_traverse_to }]);
(that regex is filtering out the dotfiles, iykyk π)
π $ff->prune()
prunes the current directory. equivalent to $ff->set_traverse_to([]). literally just yeets the whole child list. periodt. ποΈ
π [@children] = $ff->get_traverse_to()
retrieves the children that will be traversed to. returns a single array reference.
(example lives up there under set_traverse_to, bestie β scroll up π«Ά)
π [@files] = $ff->get_current_node_files_list()
gets all the files that appear in the current directory. this value remains constant for every node, even after traversal or calls to set_traverse_to(), and is useful to use as the basis of the argument for set_traverse_to(). it's the reliable friend who never changes. π§
returns a single array reference.
π BUGS π
no bugs are known, but it doesn't mean there aren't any. π iconic disclaimer. we stay humble.
π₯ SEE ALSO π₯
- there's an article about this module in the Perl Advent Calendar of 2006: <http://perladvent.pm.org/2006/2/>. vintage content, still slaps.
File::Findis the core module for traversing files in perl, which has several limitations.File::Next,File::Find::Iterator,File::Walkerand the unmaintainedFile::FTSare alternatives to this module. the whole squad, basically. π
π LICENSE π
Copyright (C) 2005, 2006 by Olivier Thauvin
this package is free software; you can redistribute it and/or modify it under the following terms:
- The GNU General Public License Version 2.0 β <http://www.opensource.org/licenses/gpl-license.php>
- The Artistic License Version 2.0 β <http://www.perlfoundation.org/legal/licenses/artistic-2_0.html>
- At your option β any later version of either or both of these licenses.
three whole options, choose your fighter π
π SUPPORT π
π Websites
the following websites have more information about this module, and may be of help to you. as always, in addition to those websites please use your favorite search engine to discover more resources. (yes, google is allowed, bestie π)
- MetaCPAN
a modern, open-source CPAN search engine, useful to view POD in HTML format.
<https://metacpan.org/release/File-Find-Object>
- RT: CPAN's Bug Tracker
the RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
<https://rt.cpan.org/Public/Dist/Display.html?Name=File-Find-Object>
- CPANTS
the CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
<http://cpants.cpanauthors.org/dist/File-Find-Object>
- CPAN Testers
the CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
<http://www.cpantesters.org/distro/F/File-Find-Object>
- CPAN Testers Matrix
the CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
<http://matrix.cpantesters.org/?dist=File-Find-Object>
- CPAN Testers Dependencies
the CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
<http://deps.cpantesters.org/?module=File::Find::Object>
π Bugs / Feature Requests
please report any bugs or feature requests by email to "bug-file-find-object at rt.cpan.org", or through the web interface at <https://rt.cpan.org/Public/Bug/Report.html?Queue=File-Find-Object>. you will be automatically notified of any progress on the request by the system. so like, you'll know. you'll know. π¬
π Source Code
the code is open to the world, and available for you to hack on. please feel free to browse it and play with it, or whatever. if you want to contribute patches, please send me a diff or prod me to pull from your repository :)
<https://github.com/shlomif/perl-file-find-object>
git clone git://github.com/shlomif/perl-file-find-object.git
go off, contribute, be the main character π«Ά
π§ AUTHOR π§
Shlomi Fish <shlomif@cpan.org>
π BUGS π
(yeah, it's a second BUGS section. the page said it twice, so we say it twice. consistency is a vibe.)
please report any bugs or feature requests on the bugtracker website <https://github.com/shlomif/perl-file-find-object/issues>
when submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. receipts, bestie. always bring receipts. π§Ύ
πΈ COPYRIGHT AND LICENSE πΈ
this software is Copyright (c) 2000 by Olivier Thauvin and others.
this is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
and that's the whole page, diva π this was File::Find::Object(3) from perl v5.42.0, dated 2025-07-25 β go traverse some files, you absolute icon πβ¨ no cap.
π¦ where this page comes from
- fedora 43: perl-File-Find-Object 0.3.9-3.fc43 Β· GPL-2.0-or-later OR Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms