If you like this site, see my recent campaign for collecting money for my works of fiction.

File-Find-Object - CPAN Module to Traverse a Directory Tree

The perl 5 distribution ships with the File::Find module, which can be used to traverse directory trees. However, it has some serious limitations:

  1. It cannot be instantiated, and also makes use of some global variables.
  2. It cannot be easily interrupted in the middle.
  3. It does not have an iterative interface.

File-Find-Object is a CPAN module, which was originally created by Olivier Thauvin and now mostly maintained by me (= Shlomi Fish) that aims to address these limitations and more, and provide Perl programmers with a robust, object-oriented and usable alternative.

Also available is File-Find-Object-Rule, which is a port of File-Find-Rule to File-Find-Object. This gives Perl programmers a convenient, declarative interface for File-Find-Object, while overcoming the limitations of File::Find.

Licence

File-Find-Object is multi-licensed under the GNU General Public Licence (GPL) version 2 or later, and the Artistic Licence version 2.0 or later.

File-Find-Object-Rule is derived from the original File-Find-Rule, and is distributed under its same terms with all subsequent copyright claims to the modifications disclaimed.

News

2009-06-26: File-Find-Object-Rule Version 0.0300

Version 0.0300 of File-Find-Object-Rule was released yesterday. The main highlight of this release is that the iterative ->start() and ->match() methods are now truly iterative and use File-Find-Object to scan the tree incrementally, instead of building a long list of results in memory, and then iterating over it.

Other, more minor, improvements included a cleanup of the code to use Class-XSAccessor , POD tests and full POD coverage, update of the documentation for File-Find-Object-Rule (instead of the original File-Find-Rule) and more links and keywords as META.yml meta-data.

2009-01-09: File-Find-Object 0.1.6 Was Released With a Huge Speed Boost

Recently, File-Find-Object was benchmarked using a test program that traversed a directory and printed the result. It turned out to run at 2 minutes (120 seconds) while File-Find did it at 4-5 seconds. As a result, we spent a lot of time in optimising File-Find-Object, and now it does the scan at about 30 seconds. These optimisations were integrated into version 0.1.6 which was uploaded to CPAN today and will be available shortly.

One thing to note is that we are now using Class-XSAccessor instead of Class-Accessor, because the conversion yielded a substantial increase in speed. More information can be found in the Changes file in the distribution.

Coverage of File-Find-Object

Coverage in Shlomi Fish’s Blogs