File-Find-Object-0.3.5000755000764000764 013614051520 14752 5ustar00shlomifshlomif000000000000Changes100644000764000764 3503613614051520 16355 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5Revision history for File-Find-Object 0.3.5 2020-01-28 - Rebuild for order of 'NAME' and 'VERSION' sections in the generated POD documentation (see: https://metacpan.org/changes/distribution/Pod-Weaver-PluginBundle-SHLOMIF#L3 ). - VERSION used to appear before NAME. 0.3.4 2019-08-25 - Add *~ files to MANIFEST.SKIP. - https://github.com/shlomif/perl-file-find-object/issues/1 - Thanks to @perlpunk and SUSE. 0.3.3 2019-08-23 - Now at https://github.com/shlomif/perl-file-find-object - tidyall . 0.3.2 2017-01-13 - Made the version number consistent across the .pm files. - https://bitbucket.org/shlomif/perl-file-find-object/issues/1/wrong-version-number - Thanks to aer0 for the report. 0.3.1 2017-01-09 - Fixed an issue with tracking the depth of the inodes when detecting a symlink loop. - Detected by several cygwin reports. 0.3.0 2016-09-11 - Converted the build system to Dist-Zilla. - Part of the impetus was removing the warning about Test::TrailingSpace needed for the trailing whitespace tests (which in turn requires this modules) which was reported to us as a problem by someone (despite not being a real issue). 0.2.13 2015-04-07 - Clarified the documentation regarding the use/return of array references. 0.2.12 2014-11-28 - Made sure no two t/*.t test scripts share temp paths. - This caused failure with HARNESS_OPTIONS="j9". - Thanks to ETHER for the report: - http://www.cpantesters.org/cpan/report/2711a2ec-7401-11e4-8c78-d7697441a48b 0.2.11 2014-03-26 - Add $VERSION globally to all packages in lib/. - This was done to silence some warnings from PAUSE. - Add scripts/bump-version-number.pl to update it. 0.2.10 2014-03-26 - Correct a misspelling reported by dsteinbrunner. - https://rt.cpan.org/Ticket/Display.html?id=94206 - Fix Build.PL by excluding the 'license' URL from the resources. - New versions of Module::Build add it automatically. 0.2.9 2014-01-29 - Convert from "use base" to the more modern "use parent". - Minimal version on perl-5.008 (CPANTS Kwalitee). - Add the LICENSE file - CPANTS Kwalitee. 0.2.8 2013-08-17 - Fix https://rt.cpan.org/Ticket/Display.html?id=87901 - repository metadata duplication. 0.2.7 2013-05-21 - Convert this file to t/cpan-changes.t . 0.2.6 2012-11-25 - Correct a typo: - see https://rt.cpan.org/Ticket/Display.html?id=81428 - Thanks to Xavier Guimard for the report. - Remove trailing space. 0.2.5 2012-07-12 - Add the scripts/tag-release.pl script to tag a release in the Mercurial repository. - The problem is that I'm using different conventions for the names of the tags in different repositories and wish to introduce some consistency. 0.2.4 2012-07-12 - Update the link to the new repository at bitbucket.org. - Add cleanup for a temporary directory in the tests. 0.2.3 2009-07-30 - 0.2.2 seems to have been deleted. Re-uploading. - thanks to lwpetre 0.2.2 2009-06-25 - added some META.yml resources. - added META.yml keywords. 0.2.1 2009-06-18 - Optimization: removed the _dir field of File::Find::Object::PathComp and its _dir_copy copy-accessor, and replaced them all with passing the $dir_str explicitly. This reduced the code considerably, and eliminated a similar symptom to this one: - http://en.wikipedia.org/wiki/Schlemiel_the_painter%27s_Algorithm - Added the ->is_file() method to ::Result. - Converted ::Result->is_dir() to use -d _ - Added ::Result->is_link(). 0.2.0 2009-02-22 - Optimization: now not checking for the existence of the callback() after every iteration, in case it doesn't exist. Instead, the default_actions is calculated according to its existence when the tree traverser is initialized. - Refactoring/Optimization: avoided having two _set_obj() methds by calling _set_obj() from _run_cb(). 0.1.9 2009-02-10 - Added use integer to the modules, because they don't make use of floating-point calculation. It may be a minor optimization, but then again it may be not. - Optimization: optimized the loop detection by having a hash lookup of inodes in each path component, that are built incrementally and checked for every subsequent node. - Optimization: replaced the _top_it() of _me_die() with a normal method with a conditional, as it was the only place where _top_it() was still used. - Optimization/Cleanup: _set_inodes() in ::DeepPath. - Clarified the licensing blurbs of the .pm files. 0.1.8 2009-01-19 - Optimization/Refactoring: replaced the last call to ->_father with a call to _current_father(). Removed ->_father and optimized _current_father() . - Optimization/Refactoring: refactored _become_default() to remove the execessive use of $father and $father->idx(). Now ->idx() is no longer needed and will be removed next. - Optimization/Refactoring: removed the ->idx() method as it was no longer used and needed. - Optimization: instead of calling File::Find::Object::Result->new() just bless to it. - Optimization: now caching the filesystem device at the top for nocrossfs(). - Plus: rearranged the order of the checks in _non_top__check_subdir_helper - Optimization/Refactoring: made the _top_it method names saner, and removed an unused one. - Refactoring: refactored _check_subdir_helper_d() to make the conditions clearer. - Optimization: now compiling the _check_subdir_helper function by eval ""'ing it because it contains many conditions that depend on instance-wide and constant parameters. - Cleanup: moved some POD'ed out functions to under rejects/ . - Optimization: renamed _calc_next_obj() to next_obj(), as next_obj() just called it directly. Cleaned up the rest of the logic in next_obj(). - Bug fix: the nocrossfs option was fixed. Previously it used an undefined method. 0.1.7 2009-01-15 - Fixed the check-for-link and for directory semantics on Windows and other systems. Converted to "perldoc -f lstat" instead of "perldoc -f stat", and using stat only for symbolic links to check if they are directories. Now added a test for that. - Fixed t/01ffo.t to check for the warning. - Also see: http://www.nntp.perl.org/group/perl.perl5.porters/2009/01/msg143399.html - Small optimization: converted a loop with: while($ptr) { ... } continue { $ptr = $self->_father($ptr); } to List::Util::first. - Added more dependencies to Build.PL / Makefile.PL including List::Util. 0.1.6 2009-01-09 - Converted the accessor generator to Class::XSAccessor instead of Class::Accessor. After consulting Devel::NYTProf, it seemed that the majority of the time of a simple File-Find-Object scan was spent in Class::Accessor. Hopefully, this will make F-F-O run faster. - A small optimization - added a flag to $self with whether the stack is full or not. This is used inside _top_it() and _is_top(). - A small optimization - implemented _current directly instead of a _top / _non_top version - saved 2.5 seconds of runtime. - A small optimization - got rid of _current_components_copy() (which was useless because _current_components already returns a dynamic reference) and replaced all calls with calls to _current_components(). - A small optimization - ->dir() instead of ->_dir_copy() for a function whose return value is dereferenced and flatted. - A small optimization - now caching the results of _current_components inside an accessor and updating it upon every change. - A small optimization - now caching the results of _current_path() upon every modification of _current_components, so File::Spec->catfile() won't be called excessively. - Optimization/Refactoring - changed the actions() handling so instead of having the indices, we calculate an array of master actions at start that correspond with the depth() parameter, and then assign it for each PathComponent object in turn based on $top. This is instead of the indexes and explicit calculations etc., which was both messier and slower. - Optimization/Refactoring - renamed _current_components() to _curr_comps() and _current_path to _curr_path() to make them shorter and faster. Added a comment explaining what they are. - Optimization/Refactoring - optimized _calc_current_item_obj. - Optimization - removed an _is_top() conditional in _recurse() that was likely not to be evaluated, by re-arranging the order of _mystat call. Now _mystat is not an action, but rather called explicitly. _is_top() is now PODded-out because it's not used. - Refactoring - made the top path component-handling object a separate object (::PathTop) instead of $top/$tree . Hopefully, this will later allow caching _current(), and having a unified directory stack. - Refactoring - created a base class for Path-Components (i.e: ::PathTop and ::PathComponent). Most of the methods out of ::Base belong there so they were moved. This class inherits from ::Base, but there's not a lot there anymore. - Refactoring - renamed ::PathComponent as ::DeepPath and ::PathTop as ::TopPath. Otherwise they could be confused with ::PathComp. - Refactoring - made the first ::PathTop component the first element in _dir_stack() so we won't need to keep in a distinct reference. All the other elements moved 1 level down the stack. - Optimization - now caching $top->_dir_stack()->[-1] into $top->_current() as an accessor. 0.1.5 2009-01-03 - Unified the two calls to stat() (and several calls to other file operators) in order to reduce the number of system calls/disk accesses issued by File::Find::Object. - Refactored the code from the last change and added File::Find::Object::Result->stat_ret() for the return value of stat(). 0.1.4 2008-12-25 - Bug fix: made sure ->item_obj() is available on the first call to the callback() and is properly synchronized with it. 0.1.3 2008-11-12 - Refactoring: converted _movenext() from pseudo-conditionals to polymorphism by making it a method of ->_current(). - Refactoring: extracted the _next_traverse_to() method. - Bug fix (with possible correctness/SECURITY implications): - now correctly handling files and directories whose filenames are false in Perl - most notable "0". 0.1.2 2008-10-26 - Corrected the README. - Now checking for inodes that are 0, when checking for cyclical trees, as a fix for stat() calls on systems that do not support them. This should fix Win32 test failures (and bad behaviour in general) like the following: - http://nntp.x.perl.org/group/perl.cpan.testers/2479582 0.1.1 2008-10-22 - Potential Security Fix!!! No longer passing a filename directly to the format in <> when warning on a loop. - Bug fix - the check for a loop was broken. - New Feature - Added the ->next_obj() and ->item_obj() methods to return a File::Find::Object::Result object instead of a plain path. - Refactoring: - No longer passing $current explicitly from one method to another (hello EEK!). Instead, we reference $self->_current() - Remmed out the DESTROY method as it was empty. - Revamped the _action handling - an array instead of a hash. - Created _top and _non_top methods delegated by _is_top using _top_it() - _current_idx() was eliminated - now it's just $#dir_stack. - Created a _copy methods to create flat copies of array references. - Extracted many methods. - Switched Build.PL to inc/Test/Run/Builder.pm - that gives us: - ./Build runtest - ./Build distruntest - ./Build tags 0.1.0 2008-03-05 - Now handling directories that cannot be opendir()'ed in a graceful manner - just not traversing them further. 0.0.9 2008-02-22 - Now running canonpath() on the targets in the call to File::Find::Object->new. That way, trailing slashes are omitted in the results. - Allow File::Find::Object to properly accept paths to regular files as input paths. Fixes: http://rt.cpan.org/Public/Bug/Display.html?id=33453 Thanks to Sergey V Panteleev for reporting the bug. - TODO : check behavior on traversing non-existant paths. - Done. - Now skipping non-existant files. - Added a test for it in t/03traverse.t 0.0.8 2007-07-31 - added the empty PL_FILES key to the Makefile.PL to avoid running Build.PL on older versions of EU::MM. 0.0.7 2007-02-02 - moved the tree script under the examples directory. - added the LICENSE section to the POD. - added t/pod.t and t/pod-coverage.t and made sure the module has full POD coverage. - added a Build.PL build script to generate a better META.yml file. - all of these are Kwalitee improvements. ( http://cpants.perl.org/dist/File-Find-Object ) - Added some links to the main POD documentation for similar modules and for the Perl Advent article. 0.0.6 2006-11-28 - Added the following new interface methods: - set_traverse_to - get_traverse_to - get_current_node_files_list - prune - Some changes to the internals to accomodate for them. 0.0.5 2006-09-03 - Eliminated the F-F-O-internal isa F-F-O relationship. - Created accessors for everything - now based on Class::Accessor - F-F-O-internal is now named File::Find::Object::PathComponent - Some smaller refactorings. 0.0.4 2006-08-23 - Eliminated circular references. (Hopefully) - Still have an isa relationship between File::Find::Object and File::Find::Object::internal, which is what handles each recursed to directory. - Created some accessor functions instead of direct hash accesses. 0.0.3 2006-07-14 - Fixed some language problems in the POD. - Added the Changes file. - Changed the license to GPL/Artistic/Artistic-2.0 - Placed the .pm files inside lib. - Added the TreeCreate module under t/lib (with appropriate tests) to test the main module. - Made the default test order lexicographical, and predictable. In the process, eliminated keeping the directory handles, and possibly the fact that they are kept open. - Fixed a bug where circular references prevented the module from being destroyed. LICENSE100644000764000764 2152213614051520 16062 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5This software is Copyright (c) 2005, 2006 by Olivier Thauvin. This is free software, licensed under: The Artistic License 2.0 (GPL Compatible) The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. Definitions "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. "You" and "your" means any person who would like to copy, distribute, or modify the Package. "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. "Source" form means the source code, documentation source, and configuration files for the Package. "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. Permission for Use and Modification Without Distribution (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. Permissions for Redistribution of the Standard Version (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. Distribution of Modified Versions of the Package as Source (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under (i) the Original License or (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. Aggregating or Linking the Package (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. Items That are Not Considered Part of a Modified Version (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. General Provisions (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dist.ini100644000764000764 156013614051520 16501 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5name = File-Find-Object author = Shlomi Fish license = Artistic_2_0 copyright_holder = Olivier Thauvin and others copyright_year = 2000 version = 0.3.5 [@Filter] -bundle = @SHLOMIF -remove = License -remove = Readme dist = File-Find-Object github_name = perl-file-find-object [Keywords] keyword = alternative-to-core keyword = directories keyword = directory keyword = directory-traversal keyword = directory-tree keyword = directory-trees keyword = file keyword = file-find keyword = find keyword = instance keyword = instantiated keyword = instantiation keyword = iterative keyword = object keyword = object-oriented keyword = oop keyword = prune keyword = traversal keyword = traverse keyword = tree [PruneFiles] match = ^rejects/ [Test::Kwalitee] [Test::TidyAll] ; authordep Pod::Weaver::PluginBundle::SHLOMIF ; authordep Code::TidyAll::Plugin::TestCount META.yml100644000764000764 3146513614051520 16335 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5--- abstract: 'An object oriented File::Find replacement' author: - 'Shlomi Fish ' build_requires: File::Path: '0' File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Module::Build: '0.28' Test::More: '0.88' lib: '0' vars: '0' configure_requires: ExtUtils::MakeMaker: '0' Module::Build: '0.28' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' keywords: - alternative-to-core - directories - directory - directory-traversal - directory-tree - directory-trees - file - file-find - find - instance - instantiated - instantiation - iterative - object - object-oriented - oop - prune - traversal - traverse - tree license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: File-Find-Object provides: File::Find::Object: file: lib/File/Find/Object.pm version: v0.3.5 File::Find::Object::Base: file: lib/File/Find/Object/Base.pm version: v0.3.5 File::Find::Object::DeepPath: file: lib/File/Find/Object.pm version: v0.3.5 File::Find::Object::PathComp: file: lib/File/Find/Object/PathComp.pm version: v0.3.5 File::Find::Object::Result: file: lib/File/Find/Object/Result.pm version: v0.3.5 File::Find::Object::TopPath: file: lib/File/Find/Object.pm version: v0.3.5 requires: Carp: '0' Class::XSAccessor: '0' Fcntl: '0' File::Spec: '0' List::Util: '0' integer: '0' parent: '0' perl: '5.008' strict: '0' warnings: '0' resources: bugtracker: https://github.com/shlomif/perl-file-find-object/issues homepage: http://metacpan.org/release/File-Find-Object repository: git://github.com/shlomif/perl-file-find-object.git version: 0.3.5 x_Dist_Zilla: perl: version: '5.030001' plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@Filter/TestMoreDoneTesting' version: '6.012' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Filter/AutoPrereqs' version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/ExecDir' version: '6.012' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . name: '@Filter/GatherDir' version: '6.012' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/ManifestSkip' version: '6.012' - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/MetaYAML' version: '6.012' - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/PruneCruft' version: '6.012' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/ShareDir' version: '6.012' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/MakeMaker' version: '6.012' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@Filter/CheckChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/ConfirmRelease' version: '6.012' - class: Dist::Zilla::Plugin::Manifest name: '@Filter/Manifest' version: '6.012' - class: Dist::Zilla::Plugin::MetaConfig name: '@Filter/MetaConfig' version: '6.012' - class: Dist::Zilla::Plugin::MetaJSON name: '@Filter/MetaJSON' version: '6.012' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000036' version: '0.006' name: '@Filter/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::MetaResources name: '@Filter/MetaResources' version: '6.012' - class: Dist::Zilla::Plugin::ModuleBuild config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/ModuleBuild' version: '6.012' - class: Dist::Zilla::Plugin::PkgVersion name: '@Filter/PkgVersion' version: '6.012' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Filter/PodCoverageTests' version: '6.012' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Filter/PodSyntaxTests' version: '6.012' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: test script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@Filter/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes name: '@Filter/Test::CPAN::Changes' version: '0.012' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@Filter/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@Filter/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::TrailingSpace name: '@Filter/Test::TrailingSpace' version: 0.2.0 - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/TestRelease' version: '6.012' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::SingleEncoding name: '@SHLOMIF/SingleEncoding' version: '4.015' - class: Pod::Weaver::Plugin::WikiDoc name: '@SHLOMIF/WikiDoc' version: '0.093004' - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@SHLOMIF/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@SHLOMIF/Prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Synopsis' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Description' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Usage' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Overview' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Stability' version: '4.015' - class: Pod::Weaver::Section::Collect name: Requirements version: '4.015' - class: Pod::Weaver::Section::Collect name: Attributes version: '4.015' - class: Pod::Weaver::Section::Collect name: Constructors version: '4.015' - class: Pod::Weaver::Section::Collect name: Methods version: '4.015' - class: Pod::Weaver::Section::Collect name: Functions version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@SHLOMIF/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@SHLOMIF/postlude' version: '4.015' - class: Pod::Weaver::Section::Support name: '@SHLOMIF/Support' version: '1.012' - class: Pod::Weaver::Section::Authors name: '@SHLOMIF/Authors' version: '4.015' - class: Pod::Weaver::Section::Bugs name: '@SHLOMIF/Bugs' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@SHLOMIF/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@SHLOMIF/Legal' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@SHLOMIF/List' version: '4.015' name: '@Filter/PodWeaver' version: '4.008' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/UploadToCPAN' version: '6.012' - class: Dist::Zilla::Plugin::Keywords config: Dist::Zilla::Plugin::Keywords: keywords: - alternative-to-core - directories - directory - directory-traversal - directory-tree - directory-trees - file - file-find - find - instance - instantiated - instantiation - iterative - object - object-oriented - oop - prune - traversal - traverse - tree name: Keywords version: '0.007' - class: Dist::Zilla::Plugin::PruneFiles name: PruneFiles version: '6.012' - class: Dist::Zilla::Plugin::Test::Kwalitee config: Dist::Zilla::Plugin::Test::Kwalitee: filename: xt/release/kwalitee.t skiptest: [] name: Test::Kwalitee version: '2.12' - class: Dist::Zilla::Plugin::Test::TidyAll name: Test::TidyAll version: '0.04' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.012' x_generated_by_perl: v5.30.1 x_serialization_backend: 'YAML::Tiny version 1.73' MANIFEST100644000764000764 134513614051520 16167 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Build.PL Changes LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README.md dist.ini examples/tree inc/Test/Run/Builder.pm lib/File/Find/Object.pm lib/File/Find/Object/Base.pm lib/File/Find/Object/PathComp.pm lib/File/Find/Object/Result.pm scripts/bump-version-number.pl scripts/tag-release.pl t/00-compile.t t/01ffo.t t/02tree-create.t t/03traverse.t t/04destroy.t t/05prune.t t/06trailing-slash.t t/lib/File/Find/Object/TreeCreate.pm t/sample-data/h.txt weaver.ini xt/author/eol.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-syntax.t xt/author/tidyall.t xt/release/cpan-changes.t xt/release/kwalitee.t xt/release/trailing-space.t Build.PL100644000764000764 271713614051520 16336 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.012. use strict; use warnings; use Module::Build 0.28; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.28" }, "configure_requires" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "dist_abstract" => "An object oriented File::Find replacement", "dist_author" => [ "Shlomi Fish " ], "dist_name" => "File-Find-Object", "dist_version" => "0.3.5", "license" => "artistic_2", "module_name" => "File::Find::Object", "recursive_test_files" => 1, "requires" => { "Carp" => 0, "Class::XSAccessor" => 0, "Fcntl" => 0, "File::Spec" => 0, "List::Util" => 0, "integer" => 0, "parent" => 0, "perl" => "5.008", "strict" => 0, "warnings" => 0 }, "test_requires" => { "File::Path" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => "0.88", "lib" => 0, "vars" => 0 } ); my %fallback_build_requires = ( "File::Path" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Build" => "0.28", "Test::More" => "0.88", "lib" => 0, "vars" => 0 ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = Module::Build->new(%module_build_args); $build->create_build_script; README.md100644000764000764 217013614051520 16312 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5File::Find::Object is an object-oriented and iterative replacement for File::Find. I.e: it is a module for traversing a directory tree, and finding all the files contained within it programatically. # INSTALLATION To install this module type the following: perl Makefile.PL make make test make install after you install all of its dependencies. Alternatively use the CPAN.pm module: # perl -MCPAN -e 'install File::Find::Object' Or the newer CPANPLUS.pm module # perl -MCPANPLUS -e 'install File::Find::Object' # DEPENDENCIES This module's dependencies are: 1. A Perl version that supports the "use warnings" pragma. 2. The Class::XSAccessor module from CPAN. # COPYRIGHT AND 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: 1. The GNU General Public License Version 2.0 - http://www.opensource.org/licenses/gpl-license.php 2. The Artistic License Version 2.0 - http://www.perlfoundation.org/legal/licenses/artistic-2_0.html 3. At your option - any later version of either or both of these licenses. t000755000764000764 013614051520 15136 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.501ffo.t100644000764000764 214513614051520 16400 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl # $Id$ use strict; use warnings; use Test::More tests => 4; use File::Path qw(rmtree); # TEST use_ok( 'File::Find::Object', "Can use main File::Find::Object" ); mkdir('t/dir'); mkdir('t/dir/a'); mkdir('t/dir/b'); open( my $h, ">", 't/dir/file' ); close($h); # symlink does not exists everywhere (windows) # if it failed, this does not matter eval { symlink( '.', 't/dir/link' ); }; my $symlink_created = ( $@ eq "" ); my ( @res1, @res2 ); my $tree = File::Find::Object->new( { callback => sub { push( @res1, $_[0] ); }, followlink => 1, }, 't/dir' ); my @warnings; local $SIG{__WARN__} = sub { my $w = shift; push @warnings, $w; }; # TEST ok( $tree, "Can get tree object" ); while ( my $r = $tree->next() ) { push( @res2, $r ); } # TEST ok( scalar(@res1) == scalar(@res2), "Get same result from callback and next" ); # TEST if ($symlink_created) { like( $warnings[0], qr{\AAvoid loop (\S+) => \1\S+?link\r?\n?\z}, "Avoid loop warning" ); } else { pass("No symlink."); } # Cleanup rmtree( 't/dir', 0, 1 ); META.json100644000764000764 5035413614051520 16503 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5{ "abstract" : "An object oriented File::Find replacement", "author" : [ "Shlomi Fish " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "keywords" : [ "alternative-to-core", "directories", "directory", "directory-traversal", "directory-tree", "directory-trees", "file", "file-find", "find", "instance", "instantiated", "instantiation", "iterative", "object", "object-oriented", "oop", "prune", "traversal", "traverse", "tree" ], "license" : [ "artistic_2" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "File-Find-Object", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.28" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Module::Build" : "0.28" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.19", "Test::Code::TidyAll" : "0.50", "Test::EOL" : "0", "Test::Kwalitee" : "1.21", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::TrailingSpace" : "0.0203" } }, "runtime" : { "requires" : { "Carp" : "0", "Class::XSAccessor" : "0", "Fcntl" : "0", "File::Spec" : "0", "List::Util" : "0", "integer" : "0", "parent" : "0", "perl" : "5.008", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Path" : "0", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::More" : "0.88", "lib" : "0", "vars" : "0" } } }, "provides" : { "File::Find::Object" : { "file" : "lib/File/Find/Object.pm", "version" : "v0.3.5" }, "File::Find::Object::Base" : { "file" : "lib/File/Find/Object/Base.pm", "version" : "v0.3.5" }, "File::Find::Object::DeepPath" : { "file" : "lib/File/Find/Object.pm", "version" : "v0.3.5" }, "File::Find::Object::PathComp" : { "file" : "lib/File/Find/Object/PathComp.pm", "version" : "v0.3.5" }, "File::Find::Object::Result" : { "file" : "lib/File/Find/Object/Result.pm", "version" : "v0.3.5" }, "File::Find::Object::TopPath" : { "file" : "lib/File/Find/Object.pm", "version" : "v0.3.5" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/shlomif/perl-file-find-object/issues" }, "homepage" : "http://metacpan.org/release/File-Find-Object", "repository" : { "type" : "git", "url" : "git://github.com/shlomif/perl-file-find-object.git", "web" : "https://github.com/shlomif/perl-file-find-object" } }, "version" : "0.3.5", "x_Dist_Zilla" : { "perl" : { "version" : "5.030001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@Filter/TestMoreDoneTesting", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@Filter/AutoPrereqs", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/ExecDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "@Filter/GatherDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/ManifestSkip", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/MetaYAML", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/PruneCruft", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/ShareDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/MakeMaker", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@Filter/CheckChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/ConfirmRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/Manifest", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Filter/MetaConfig", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Filter/MetaJSON", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000036", "version" : "0.006" } }, "name" : "@Filter/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Filter/MetaResources", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ModuleBuild", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/ModuleBuild", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Filter/PkgVersion", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Filter/PodCoverageTests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Filter/PodSyntaxTests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "test", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@Filter/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes" } }, "name" : "@Filter/Test::CPAN::Changes", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@Filter/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@Filter/Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::Test::TrailingSpace", "name" : "@Filter/Test::TrailingSpace", "version" : "0.2.0" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/TestRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@SHLOMIF/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::WikiDoc", "name" : "@SHLOMIF/WikiDoc", "version" : "0.093004" }, { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@SHLOMIF/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@SHLOMIF/Prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Synopsis", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Description", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Usage", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Overview", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Stability", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Requirements", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Attributes", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Constructors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Methods", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Functions", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@SHLOMIF/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@SHLOMIF/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Support", "name" : "@SHLOMIF/Support", "version" : "1.012" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@SHLOMIF/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Bugs", "name" : "@SHLOMIF/Bugs", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@SHLOMIF/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@SHLOMIF/Legal", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@SHLOMIF/List", "version" : "4.015" } ] } }, "name" : "@Filter/PodWeaver", "version" : "4.008" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/UploadToCPAN", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Keywords", "config" : { "Dist::Zilla::Plugin::Keywords" : { "keywords" : [ "alternative-to-core", "directories", "directory", "directory-traversal", "directory-tree", "directory-trees", "file", "file-find", "find", "instance", "instantiated", "instantiation", "iterative", "object", "object-oriented", "oop", "prune", "traversal", "traverse", "tree" ] } }, "name" : "Keywords", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::PruneFiles", "name" : "PruneFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Test::Kwalitee", "config" : { "Dist::Zilla::Plugin::Test::Kwalitee" : { "filename" : "xt/release/kwalitee.t", "skiptest" : [] } }, "name" : "Test::Kwalitee", "version" : "2.12" }, { "class" : "Dist::Zilla::Plugin::Test::TidyAll", "name" : "Test::TidyAll", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.012" } }, "x_generated_by_perl" : "v5.30.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.18" } weaver.ini100644000764000764 1313614051520 16757 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5[@SHLOMIF] 05prune.t100644000764000764 1602213614051520 17002 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 4; BEGIN { use File::Spec; use lib File::Spec->catdir( File::Spec->curdir(), "t", "lib" ); } use File::Find::Object::TreeCreate; use File::Find::Object; use File::Path; { my $tree = { 'name' => "prune--traverse-2/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "please-prune-me/", 'subs' => [ { 'name' => "a-non-reachable-dir/", 'subs' => [ { 'name' => "dir1/", }, { 'name' => "dir2/", }, { 'name' => "if-we-get-this-its-wrong.txt", 'content' => "Hi ho!", }, ], }, { 'name' => "h.rnd", 'contents' => "This file is empty.", }, { 'name' => "lambda.calculus", 'contents' => '\f \x (f (f x))' }, ], }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/prune--traverse-2") ); my @results; for my $i ( 1 .. 7 ) { my $file = $ff->next(); # We're doing that because get_current_node_files_list() used to # call ->_recurse() which caused some subtle bugs. my $files_in_node = $ff->get_current_node_files_list(); if ( $file eq $t->get_path("t/sample-data/prune--traverse-2/foo/please-prune-me") ) { $ff->set_traverse_to( [ grep { $_ !~ /non-reachable/ } @{ $ff->get_current_node_files_list() } ] ); # TEST is_deeply( $ff->get_traverse_to(), [ "h.rnd", "lambda.calculus" ], "Testing ->get_traverse_to()" ); } push @results, $file; } # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/prune--traverse-2/$_") } ( "", qw( a b.doc foo foo/please-prune-me foo/please-prune-me/h.rnd foo/please-prune-me/lambda.calculus ) ) ) ], "Checking for regular, lexicographically sorted order", ); rmtree( $t->get_path("./t/sample-data/prune--traverse-2") ) } { my $tree = { 'name' => "prune--traverse-2/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "please-prune-me/", 'subs' => [ { 'name' => "a-non-reachable-dir/", 'subs' => [ { 'name' => "dir1/", }, { 'name' => "dir2/", }, { 'name' => "if-we-get-this-its-wrong.txt", 'content' => "Hi ho!", }, ], }, { 'name' => "h.rnd", 'contents' => "This file is empty.", }, { 'name' => "lambda.calculus", 'contents' => '\f \x (f (f x))' }, ], }, { 'name' => "zardoz/", 'subs' => [ { 'name' => "p.txt", 'contents' => "Intentionally Left Boring.", }, ], }, ], }, { 'name' => "zardoz/", 'subs' => [ { 'name' => "p.txt", 'contents' => "Intentionally Left Boring.", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/prune--traverse-2") ); my @results; for my $i ( 1 .. 9 ) { my $file = $ff->next(); if ( $file eq $t->get_path("t/sample-data/prune--traverse-2/foo/please-prune-me") ) { $ff->prune(); } push @results, $file; } # TEST ok( !defined( $ff->next() ), "Testing that the scan has completed." ); # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/prune--traverse-2/$_") } ( "", qw( a b.doc foo foo/please-prune-me foo/zardoz foo/zardoz/p.txt zardoz zardoz/p.txt ) ) ) ], "Checking for regular, lexicographically sorted order", ); rmtree( $t->get_path("./t/sample-data/prune--traverse-2") ) } Makefile.PL100644000764000764 327013614051520 17007 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "An object oriented File::Find replacement", "AUTHOR" => "Shlomi Fish ", "BUILD_REQUIRES" => { "Module::Build" => "0.28" }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "DISTNAME" => "File-Find-Object", "LICENSE" => "artistic_2", "MIN_PERL_VERSION" => "5.008", "NAME" => "File::Find::Object", "PREREQ_PM" => { "Carp" => 0, "Class::XSAccessor" => 0, "Fcntl" => 0, "File::Spec" => 0, "List::Util" => 0, "integer" => 0, "parent" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Path" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => "0.88", "lib" => 0, "vars" => 0 }, "VERSION" => "0.3.5", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Class::XSAccessor" => 0, "Fcntl" => 0, "File::Path" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "List::Util" => 0, "Module::Build" => "0.28", "Test::More" => "0.88", "integer" => 0, "lib" => 0, "parent" => 0, "strict" => 0, "vars" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MANIFEST.SKIP100644000764000764 313614051520 16642 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5~$ examples000755000764000764 013614051520 16511 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5tree100755000764000764 55113614051520 17517 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/examples#!/usr/bin/perl # $Id$ use strict; use warnings; use File::Find::Object; use Getopt::Long; my %options; GetOptions( 'd' => \$options{depth}, 'n' => \$options{nonet}, 'f' => \$options{nocrossfs}, 'l' => \$options{followlink}, ); my $tree = File::Find::Object->new({ %options }, @ARGV); while (my $r = $tree->next()) { print $r ."\n"; } 04destroy.t100644000764000764 360013614051520 17317 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 2; BEGIN { use File::Spec; use lib File::Spec->catdir( File::Spec->curdir(), "t", "lib" ); } use File::Find::Object::TreeCreate; use File::Find::Object; use File::Path; package MyFFO; use vars qw(@ISA); @ISA = (qw(File::Find::Object)); sub DESTROY { my $self = shift; $self->{'**DESTROY**'}->(); } package main; my $destroy_counter = 0; sub my_destroy { $destroy_counter++; } { my $tree = { 'name' => "destroy--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = MyFFO->new( {}, $t->get_path("./t/sample-data/destroy--traverse-1") ); $ff->{'**DESTROY**'} = \&my_destroy; my @results; for my $i ( 1 .. 6 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/destroy--traverse-1/$_") } ( "", qw( a b.doc foo foo/yet ) ) ), undef ], "Checking for regular, lexicographically sorted order", ); rmtree( $t->get_path("./t/sample-data/destroy--traverse-1") ) } # TEST is( $destroy_counter, 1, "Check that the object was destroyed when it goes out of scope." ); 03traverse.t100644000764000764 4265213614051520 17512 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 46; BEGIN { use File::Spec; use lib File::Spec->catdir( File::Spec->curdir(), "t", "lib" ); } use File::Find::Object::TreeCreate; use File::Find::Object; use File::Path; { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/traverse--traverse-1") ); my @results; for my $i ( 1 .. 6 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/traverse--traverse-1/$_") } ( "", qw( a b.doc foo foo/yet ) ) ), undef ], "Checking for regular, lexicographically sorted order", ); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ); } { my $test_id = "traverse--traverse-dirs-and-files"; my $test_dir = "t/sample-data/$test_id"; my $tree = { 'name' => "$test_id/", 'subs' => [ { 'name' => "a/", subs => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, ], }, { 'name' => "foo/", 'subs' => [ { 'name' => "t.door.txt", 'contents' => "A T Door", }, { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./$test_dir/a/b.doc"), $t->get_path("./$test_dir/foo"), ); my @results; for my $i ( 1 .. 5 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("$test_dir/$_") } ( qw( a/b.doc foo foo/t.door.txt foo/yet ) ) ), undef ], "Checking that one can traverse regular files.", ); rmtree( $t->get_path("./$test_dir") ) } { my $test_id = "traverse--dont-traverse-non-existing-files"; my $test_dir = "t/sample-data/$test_id"; my $tree = { 'name' => "$test_id/", 'subs' => [ { 'name' => "a/", subs => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, ], }, { 'name' => "c/", subs => [ { 'name' => "d.doc", 'contents' => "This file was spotted in the wild.", }, ], }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, { 'name' => "bar/", 'subs' => [ { name => "myfile.txt", content => "Hello World", }, { 'name' => "zamda/", }, ], }, { 'name' => "daps/", }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./$test_dir/foo"), $t->get_path("./$test_dir/a/non-exist"), $t->get_path("./$test_dir/bar"), $t->get_path("./$test_dir/b/non-exist"), $t->get_path("./$test_dir/daps"), ); my @results; for my $i ( 1 .. 7 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("$test_dir/$_") } ( qw( foo foo/yet bar bar/myfile.txt bar/zamda daps ) ) ), undef ], "Checking that we skip non-existent paths", ); rmtree( $t->get_path("./$test_dir") ) } { my $test_id = "traverse--handle-non-accessible-dirs-gracefully"; my $test_dir = "t/sample-data/$test_id"; my $tree = { 'name' => "$test_id/", 'subs' => [ { 'name' => "a/", subs => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, ], }, { 'name' => "c/", subs => [ { 'name' => "d.doc", 'contents' => "This file was spotted in the wild.", }, ], }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, { 'name' => "bar/", 'subs' => [ { name => "myfile.txt", content => "Hello World", }, { 'name' => "zamda/", }, ], }, { 'name' => "daps/", }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); chmod( 0000, $t->get_path("$test_dir/bar") ); eval { my $ff = File::Find::Object->new( {}, $t->get_path("$test_dir") ); my @results; while ( defined( my $result = $ff->next() ) ) { push @results, $result; } # TEST ok( scalar( grep { $_ eq $t->get_path("$test_dir/a") } @results ), "Found /a", ); }; # TEST is( $@, "", "Handle non-accessible directories gracefully" ); chmod( 0755, $t->get_path("$test_dir/bar") ); rmtree( $t->get_path("./$test_dir") ) } { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "file.txt", 'contents' => "A file that should come before yet/", }, { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/traverse--traverse-1") ); { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/"), "Path" ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [], "Dir_Components are empty" ); # TEST ok( $r->is_dir(), "Is a directory" ); # TEST ok( !$r->is_link(), "Not a link" ); # TEST is_deeply( $r->full_components(), [], "Full components are empty" ); } { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/a"), "Path" ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [qw(a)], "Dir_Components are 'a'" ); # TEST ok( $r->is_dir(), "Is a directory" ); # TEST is_deeply( $r->full_components(), [qw(a)], "Full components are 'a'" ); } { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/b.doc"), "Path" ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [], "Dir_Components are empty" ); # TEST ok( !$r->is_dir(), "Not a directory" ); # TEST ok( !$r->is_link(), "Not a link" ); # TEST is_deeply( $r->full_components(), [qw(b.doc)], "Full components are 'b.doc'" ); # TEST is( $r->basename(), "b.doc", "Basename is 'b.doc'" ); } { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/foo"), "Path" ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [qw(foo)], "Dir_Components are 'foo'" ); # TEST ok( $r->is_dir(), "Is a directory" ); # TEST is_deeply( $r->full_components(), [qw(foo)], "Full components are 'foo'" ); } { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/foo/file.txt"), "Path", ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [qw(foo)], "Dir_Components are 'foo'" ); # TEST ok( !$r->is_dir(), "Not a directory" ); # TEST is_deeply( $r->full_components(), [qw(foo file.txt)], "Full components are 'foo/file.txt'" ); # TEST is( $r->basename(), "file.txt", "Basename is 'file.txt'" ); } { my $r = $ff->next_obj(); # TEST is( $r->path(), $t->get_path("t/sample-data/traverse--traverse-1/foo/yet"), "Path", ); # TEST is( $r->base(), $t->get_path("./t/sample-data/traverse--traverse-1"), "Base" ); # TEST is_deeply( $r->dir_components(), [qw(foo yet)], "Dir_Components are 'foo/yet'" ); # TEST ok( $r->is_dir(), "Is a directory" ); # TEST is_deeply( $r->full_components(), [qw(foo yet)], "Full components are 'foo/yet'" ); } { my $r = $ff->next_obj(); # TEST ok( !defined($r), "Last result is undef" ); } undef($ff); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ) } { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "0/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "0", 'contents' => "Zero file", }, { 'name' => "1", 'contents' => "One file", }, { 'name' => "2", 'contents' => "Two file", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/traverse--traverse-1") ); my @results; for my $i ( 1 .. 7 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/traverse--traverse-1/$_") } sort { $a cmp $b } ( "", qw( 0 foo foo/0 foo/1 foo/2 ) ) ), undef ], "Checking that files named '0' are correctly scanned", ); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ); } { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff; my $callback = sub { my $path = shift; my $path_obj = $ff->item_obj(); # TEST ok( $path_obj, "Path object is defined." ); # TEST is_deeply( $path_obj->full_components(), [], "Path empty." ); # TEST ok( $path_obj->is_dir(), "Path object is a directory" ); }; $ff = File::Find::Object->new( { callback => $callback }, $t->get_path("./t/sample-data/traverse--traverse-1") ); my @results; # Call $ff->next() and do the tests in $callback . push @results, $ff->next(); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ); } { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( { nocrossfs => 1, }, $t->get_path("./t/sample-data/traverse--traverse-1") ); my @results; for my $i ( 1 .. 6 ) { push @results, $ff->next(); } # TEST is_deeply( \@results, [ ( map { $t->get_path("t/sample-data/traverse--traverse-1/$_") } ( "", qw( a b.doc foo foo/yet ) ) ), undef ], "Testing nocrossfs", ); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ); } { my $tree = { 'name' => "traverse--traverse-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "file.txt", 'contents' => "A file that should come before yet/", }, { 'name' => "yet/", }, ], }, ], }; my $t = File::Find::Object::TreeCreate->new(); $t->create_tree( "./t/sample-data/", $tree ); my $ff = File::Find::Object->new( {}, $t->get_path("./t/sample-data/traverse--traverse-1") ); my @results; while ( my $r = $ff->next_obj() ) { if ( $r->is_file() ) { push @results, $r->path(); } } # TEST is_deeply( \@results, [ map { $t->get_path("t/sample-data/traverse--traverse-1/$_") } (qw(b.doc foo/file.txt)) ], "Checking for regular, lexicographically sorted order", ); rmtree( $t->get_path("./t/sample-data/traverse--traverse-1") ) } 00-compile.t100644000764000764 300713614051520 17330 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'File/Find/Object.pm', 'File/Find/Object/Base.pm', 'File/Find/Object/PathComp.pm', 'File/Find/Object/Result.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; author000755000764000764 013614051520 16630 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xteol.t100644000764000764 112313614051520 17731 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/File/Find/Object.pm', 'lib/File/Find/Object/Base.pm', 'lib/File/Find/Object/PathComp.pm', 'lib/File/Find/Object/Result.pm', 't/00-compile.t', 't/01ffo.t', 't/02tree-create.t', 't/03traverse.t', 't/04destroy.t', 't/05prune.t', 't/06trailing-slash.t', 't/lib/File/Find/Object/TreeCreate.pm', 't/sample-data/h.txt' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; 02tree-create.t100644000764000764 1106613614051520 20051 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 22; BEGIN { use File::Spec; use lib File::Spec->catdir( File::Spec->curdir(), "t", "lib" ); } use File::Path; use File::Find::Object::TreeCreate; { my $t = File::Find::Object::TreeCreate->new(); # TEST ok( $t, "TreeCreate object was initialized" ); # TEST is( $t->get_path("./t/file.txt"), File::Spec->catfile( File::Spec->curdir(), "t", "file.txt" ) ); # TEST is( $t->get_path("./t/mydir/"), File::Spec->catdir( File::Spec->curdir(), "t", "mydir" ) ); # TEST is( $t->get_path("./t/hello/there/world.jpg"), File::Spec->catfile( File::Spec->curdir(), "t", "hello", "there", "world.jpg" ) ); # TEST is( $t->get_path("./one/two/three/four/"), File::Spec->catdir( File::Spec->curdir(), "one", "two", "three", "four" ) ); } { my $t = File::Find::Object::TreeCreate->new(); # TEST ok( $t->exist("./MANIFEST"), "Checking the exist() method" ); # TEST ok( !$t->exist("./BKLASDJASFDJODIJASDOJASODJ.wok"), "Checking the exist() method" ); # TEST ok( $t->is_file("./MANIFEST"), "Checking the is_file method" ); # TEST ok( !$t->is_file("./t"), "Checking the is_file method - 2" ); # TEST ok( !$t->is_dir("./MANIFEST"), "Checking the is_dir method - false" ); # TEST ok( $t->is_dir("./t"), "Checking the is_dir method - true" ); # TEST is( $t->cat("./t/sample-data/h.txt"), "Hello.", "Checking the cat method" ); { mkdir( $t->get_path("./t/sample-data/tree-create-ls-test") ); mkdir( $t->get_path("./t/sample-data/tree-create-ls-test/a") ); { open my $out_fh, ">", $t->get_path("./t/sample-data/tree-create-ls-test/b.txt"); print {$out_fh} "Yowza"; close($out_fh); } mkdir( $t->get_path("./t/sample-data/tree-create-ls-test/c") ); { open my $out_fh, ">", $t->get_path("./t/sample-data/tree-create-ls-test/h.xls"); print {$out_fh} "FooBardom!\n"; close($out_fh); } # TEST is_deeply( $t->ls("./t/sample-data/tree-create-ls-test"), [ "a", "b.txt", "c", "h.xls" ], "Testing the ls method", ); # Cleanup rmtree( $t->get_path("./t/sample-data/tree-create-ls-test") ); } { my $tree = { 'name' => "tree-create--tree-test-1/", 'subs' => [ { 'name' => "b.doc", 'contents' => "This file was spotted in the wild.", }, { 'name' => "a/", }, { 'name' => "foo/", 'subs' => [ { 'name' => "yet/", }, ], }, ], }; $t->create_tree( "./t/sample-data/", $tree ); # TEST is_deeply( $t->ls("./t/sample-data/tree-create--tree-test-1"), [ "a", "b.doc", "foo" ], "Testing the contents of the root tree" ); # TEST ok( $t->is_dir("./t/sample-data/tree-create--tree-test-1/a"), "a is a dir" ); # TEST is_deeply( $t->ls("./t/sample-data/tree-create--tree-test-1/a"), [], "Testing the contents of a" ); # TEST is_deeply( $t->ls("./t/sample-data/tree-create--tree-test-1/foo"), ["yet"], "Testing the contents of foo" ); # TEST ok( $t->is_dir("./t/sample-data/tree-create--tree-test-1/foo/yet"), "Testing that foo/yet is a dir" ); # TEST is_deeply( $t->ls("./t/sample-data/tree-create--tree-test-1/foo/yet"), [], "Testing that foo/yet is a dir" ); # TEST ok( $t->is_file("./t/sample-data/tree-create--tree-test-1/b.doc"), "Checking that b.doc is a file" ); # TEST is( $t->cat("./t/sample-data/tree-create--tree-test-1/b.doc"), "This file was spotted in the wild.", "Checking for contents of b.doc" ); # Cleanup rmtree( $t->get_path("./t/sample-data/tree-create--tree-test-1") ); } { # TEST is( $t->get_path("s/hello"), File::Spec->catfile( "s", "hello" ), "Bug that eliminated ^[AnyChar]/ instead of ^\\./" ); } } sample-data000755000764000764 013614051520 17326 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/th.txt100644000764000764 613614051520 20372 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t/sample-dataHello.no-tabs.t100644000764000764 107113614051520 20517 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/File/Find/Object.pm', 'lib/File/Find/Object/Base.pm', 'lib/File/Find/Object/PathComp.pm', 'lib/File/Find/Object/Result.pm', 't/00-compile.t', 't/01ffo.t', 't/02tree-create.t', 't/03traverse.t', 't/04destroy.t', 't/05prune.t', 't/06trailing-slash.t', 't/lib/File/Find/Object/TreeCreate.pm', 't/sample-data/h.txt' ); notabs_ok($_) foreach @files; done_testing; tidyall.t100644000764000764 52213614051520 20576 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/author# This file was automatically generated by Dist::Zilla::Plugin::Test::TidyAll v$VERSION use Test::More 0.88; use Test::Code::TidyAll 0.24; tidyall_ok( verbose => ( exists $ENV{TEST_TIDYALL_VERBOSE} ? $ENV{TEST_TIDYALL_VERBOSE} : 0 ), jobs => ( exists $ENV{TEST_TIDYALL_JOBS} ? $ENV{TEST_TIDYALL_JOBS} : 1 ), ); done_testing; 06trailing-slash.t100644000764000764 61013614051520 20527 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; BEGIN { use File::Spec; use lib File::Spec->catdir( File::Spec->curdir(), "t", "lib" ); } use File::Find::Object; use File::Path; { my $ff = File::Find::Object->new( {}, "t/", ); my @results; push @results, $ff->next(); # TEST is_deeply( \@results, ["t"], "t has no trailing slash" ); } release000755000764000764 013614051520 16746 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xtkwalitee.t100644000764000764 27513614051520 21064 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/release# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok(); done_testing; scripts000755000764000764 013614051520 16362 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5tag-release.pl100644000764000764 65013614051520 21231 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/scripts#!/usr/bin/perl use strict; use warnings; use IO::All; my ($version) = ( map { m{\Aversion * = *(\S+)} ? ($1) : () } io->file("./dist.ini")->getlines() ); if ( !defined($version) ) { die "Version is undefined!"; } my @cmd = ( "git", "tag", "-m", "Tagging the File-Find-Object release as $version", "releases/$version", ); print join( " ", map { /\s/ ? qq{"$_"} : $_ } @cmd ), "\n"; exec(@cmd); pod-syntax.t100644000764000764 25213614051520 21242 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Find000755000764000764 013614051520 17200 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/FileObject.pm100644000764000764 4426113614051520 21133 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/File/Findpackage File::Find::Object; $File::Find::Object::VERSION = '0.3.5'; use strict; use warnings; package File::Find::Object::DeepPath; $File::Find::Object::DeepPath::VERSION = '0.3.5'; use strict; use warnings; use 5.008; use integer; use parent 'File::Find::Object::PathComp'; use File::Spec (); sub new { my ( $class, $top, $from ) = @_; my $self = {}; bless $self, $class; $self->_stat_ret( $top->_top_stat_copy() ); my $find = { %{ $from->_inodes() } }; if ( my $inode = $self->_inode ) { $find->{ join( ",", $self->_dev(), $inode ) } = $#{ $top->_dir_stack() }; } $self->_set_inodes($find); $self->_last_dir_scanned(undef); $top->_fill_actions($self); push @{ $top->_curr_comps() }, ""; return $top->_open_dir() ? $self : undef; } sub _move_next { my ( $self, $top ) = @_; if ( defined( $self->_curr_file( $top->_current_father()->_next_traverse_to() ) ) ) { $top->_curr_comps()->[-1] = $self->_curr_file(); $top->_calc_curr_path(); $top->_fill_actions($self); $top->_mystat(); return 1; } else { return 0; } } package File::Find::Object::TopPath; $File::Find::Object::TopPath::VERSION = '0.3.5'; use parent 'File::Find::Object::PathComp'; sub new { my $class = shift; my $top = shift; my $self = {}; bless $self, $class; $top->_fill_actions($self); return $self; } sub _move_to_next_target { my $self = shift; my $top = shift; my $target = $self->_curr_file( $top->_calc_next_target() ); @{ $top->_curr_comps() } = ($target); $top->_calc_curr_path(); return $target; } sub _move_next { my $self = shift; my $top = shift; while ( $top->_increment_target_index() ) { if ( -e $self->_move_to_next_target($top) ) { $top->_fill_actions($self); $top->_mystat(); $self->_stat_ret( $top->_top_stat_copy() ); $top->_dev( $self->_dev ); my $inode = $self->_inode(); $self->_set_inodes( ( $inode == 0 ) ? {} : { join( ",", $self->_dev(), $inode ) => 0, }, ); return 1; } } return 0; } package File::Find::Object; use strict; use warnings; use parent 'File::Find::Object::Base'; use File::Find::Object::Result (); use Fcntl ':mode'; use List::Util (); sub _get_options_ids { my $class = shift; return [ qw( callback depth filter followlink nocrossfs ) ]; } # _curr_comps are the components (comps) of the master object's current path. # _curr_path is the concatenated path itself. use Class::XSAccessor accessors => { ( map { $_ => $_ } ( qw( _check_subdir_h _curr_comps _current _curr_path _def_actions _dev _dir_stack item_obj _target_index _targets _top_is_dir _top_is_link _top_stat ), @{ __PACKAGE__->_get_options_ids() } ) ) }; __PACKAGE__->_make_copy_methods( [ qw( _top_stat ) ] ); use Carp; sub new { my ( $class, $options, @targets ) = @_; # The *existence* of an _st key inside the struct # indicates that the stack is full. # So now it's empty. my $tree = { _dir_stack => [], _curr_comps => [], }; bless( $tree, $class ); foreach my $opt ( @{ $tree->_get_options_ids() } ) { $tree->$opt( $options->{$opt} ); } $tree->_gen_check_subdir_helper(); $tree->_targets( \@targets ); $tree->_target_index(-1); $tree->_calc_default_actions(); push @{ $tree->_dir_stack() }, $tree->_current( File::Find::Object::TopPath->new($tree) ); $tree->_last_dir_scanned(undef); return $tree; } sub _curr_not_a_dir { return !shift->_top_is_dir(); } # Calculates _curr_path from $self->_curr_comps(). # Must be called whenever _curr_comps is modified. sub _calc_curr_path { my $self = shift; $self->_curr_path( File::Spec->catfile( @{ $self->_curr_comps() } ) ); return; } sub _calc_current_item_obj { my $self = shift; my @comps = @{ $self->_curr_comps() }; my $ret = { path => scalar( $self->_curr_path() ), dir_components => \@comps, base => shift(@comps), stat_ret => scalar( $self->_top_stat_copy() ), is_file => scalar( -f _ ), is_dir => scalar( -d _ ), is_link => $self->_top_is_link(), }; if ( $self->_curr_not_a_dir() ) { $ret->{basename} = pop(@comps); } return bless $ret, "File::Find::Object::Result"; } sub next_obj { my $self = shift; until ( $self->_process_current || ( ( !$self->_master_move_to_next() ) && $self->_me_die() ) ) { # Do nothing } return $self->item_obj(); } sub next { my $self = shift; $self->next_obj(); return $self->item(); } sub item { my $self = shift; return $self->item_obj() ? $self->item_obj()->path() : undef; } sub _current_father { return shift->_dir_stack->[-2]; } sub _increment_target_index { my $self = shift; $self->_target_index( $self->_target_index() + 1 ); return ( $self->_target_index() < scalar( @{ $self->_targets() } ) ); } sub _calc_next_target { my $self = shift; my $target = $self->_targets()->[ $self->_target_index() ]; return defined($target) ? File::Spec->canonpath($target) : undef; } sub _master_move_to_next { my $self = shift; return $self->_current()->_move_next($self); } sub _me_die { my $self = shift; if ( exists( $self->{_st} ) ) { return $self->_become_default(); } $self->item_obj( undef() ); return 1; } sub _become_default { my $self = shift; my $st = $self->_dir_stack(); pop(@$st); $self->_current( $st->[-1] ); pop( @{ $self->_curr_comps() } ); if ( @$st == 1 ) { delete( $self->{_st} ); } else { # If depth is false, then we no longer need the _curr_path # of the directories above the previously-set value, because we # already traversed them. if ( $self->depth() ) { $self->_calc_curr_path(); } } return 0; } sub _calc_default_actions { my $self = shift; my @calc_obj = $self->callback() ? (qw(_run_cb)) : (qw(_set_obj)); my @rec = qw(_recurse); $self->_def_actions( [ $self->depth() ? ( @rec, @calc_obj ) : ( @calc_obj, @rec ) ] ); return; } sub _fill_actions { my $self = shift; my $other = shift; $other->_actions( [ @{ $self->_def_actions() } ] ); return; } sub _mystat { my $self = shift; $self->_top_stat( [ lstat( $self->_curr_path() ) ] ); $self->_top_is_dir( scalar( -d _ ) ); if ( $self->_top_is_link( scalar( -l _ ) ) ) { stat( $self->_curr_path() ); $self->_top_is_dir( scalar( -d _ ) ); } return "SKIP"; } sub _next_action { my $self = shift; return shift( @{ $self->_current->_actions() } ); } sub _check_process_current { my $self = shift; return ( defined( $self->_current->_curr_file() ) && $self->_filter_wrapper() ); } # Return true if there is something next sub _process_current { my $self = shift; if ( !$self->_check_process_current() ) { return 0; } else { return $self->_process_current_actions(); } } sub _set_obj { my $self = shift; $self->item_obj( $self->_calc_current_item_obj() ); return 1; } sub _run_cb { my $self = shift; $self->_set_obj(); $self->callback()->( $self->_curr_path() ); return 1; } sub _process_current_actions { my $self = shift; while ( my $action = $self->_next_action() ) { my $status = $self->$action(); if ( $status ne "SKIP" ) { return $status; } } return 0; } sub _recurse { my $self = shift; $self->_check_subdir() or return "SKIP"; push @{ $self->_dir_stack() }, $self->_current( File::Find::Object::DeepPath->new( $self, $self->_current() ) ); $self->{_st} = 1; return 0; } sub _filter_wrapper { my $self = shift; return defined( $self->filter() ) ? $self->filter()->( $self->_curr_path() ) : 1; } sub _check_subdir { my $self = shift; # If current is not a directory always return 0, because we may # be asked to traverse single-files. if ( $self->_curr_not_a_dir() ) { return 0; } else { return $self->_check_subdir_h()->($self); } } sub _warn_about_loop { my $self = shift; my $component_idx = shift; # Don't pass strings directly to the format. # Instead - use %s # This was a security problem. warn( sprintf( "Avoid loop %s => %s\n", File::Spec->catdir( @{ $self->_curr_comps() }[ 0 .. $component_idx ] ), $self->_curr_path(), ) ); return; } sub _is_loop { my $self = shift; my $key = join( ",", @{ $self->_top_stat() }[ 0, 1 ] ); my $lookup = $self->_current->_inodes; if ( exists( $lookup->{$key} ) ) { $self->_warn_about_loop( $lookup->{$key} ); return 1; } else { return; } } # We eval "" the helper of check_subdir because the conditions that # affect the checks are instance-wide and constant and so we can # determine how the code should look like. sub _gen_check_subdir_helper { my $self = shift; my @clauses; if ( !$self->followlink() ) { push @clauses, '$s->_top_is_link()'; } if ( $self->nocrossfs() ) { push @clauses, '($s->_top_stat->[0] != $s->_dev())'; } push @clauses, '$s->_is_loop()'; $self->_check_subdir_h( _context_less_eval( 'sub { my $s = shift; ' . 'return ((!exists($s->{_st})) || !(' . join( "||", @clauses ) . '));' . '}' ) ); } sub _context_less_eval { ## no critic my $code = shift; return eval $code; ## use critic } sub _open_dir { my $self = shift; return $self->_current()->_component_open_dir( $self->_curr_path() ); } sub set_traverse_to { my ( $self, $children ) = @_; # Make sure we scan the current directory for sub-items first. $self->get_current_node_files_list(); $self->_current->_traverse_to( [@$children] ); } sub get_traverse_to { my $self = shift; return $self->_current->_traverse_to_copy(); } sub get_current_node_files_list { my $self = shift; # _open_dir can return undef if $self->_current is not a directory. if ( $self->_open_dir() ) { return $self->_current->_files_copy(); } else { return []; } } sub prune { my $self = shift; return $self->set_traverse_to( [] ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::Find::Object - An object oriented File::Find replacement =head1 VERSION version 0.3.5 =head1 SYNOPSIS use File::Find::Object; my $tree = File::Find::Object->new({}, @targets); while (my $r = $tree->next()) { print $r ."\n"; } =head1 DESCRIPTION File::Find::Object does the same job as File::Find but works like an object and with an iterator. As File::Find is not object oriented, one cannot perform multiple searches in the same application. The second problem of File::Find is its file processing: after starting its main loop, one cannot easily wait for another event and so get the next result. With File::Find::Object you can get the next file by calling the next() function, but setting a callback is still possible. =head1 FUNCTIONS =head2 new my $ffo = File::Find::Object->new( { options }, @targets); Create a new File::Find::Object object. C<@targets> is the list of directories or files which the object should explore. =head3 options =over 4 =item depth Boolean - returns the directory content before the directory itself. =item nocrossfs Boolean - doesn't continue on filesystems different than the parent. =item followlink Boolean - follow symlinks when they point to a directory. You can safely set this option to true as File::Find::Object does not follow the link if it detects a loop. =item filter Function reference - should point to a function returning TRUE or FALSE. This function is called with the filename to filter, if the function return FALSE, the file is skipped. =item 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. =back =head2 next Returns the next file found by the File::Find::Object. It returns undef once the scan is completed. =head2 item Returns the current filename found by the File::Find::Object object, i.e: the last value returned by next(). =head2 next_obj Like next() only returns the result as a convenient L object. C<< $ff->next() >> is equivalent to C<< $ff->next_obj()->path() >>. =head2 item_obj Like item() only returns the result as a convenient L object. C<< $ff->item() >> is equivalent to C<< $ff->item_obj()->path() >>. =head2 $ff->set_traverse_to([@children]) Sets the children to traverse to from the current node. Useful for pruning items to traverse. Accepts a single array reference. Example: $ff->set_traverse_to([ grep { ! /\A\./ } @{ $ff->get_traverse_to }]); =head2 $ff->prune() Prunes the current directory. Equivalent to $ff->set_traverse_to([]). =head2 [@children] = $ff->get_traverse_to() Retrieves the children that will be traversed to. Returns a single array reference. (Example under C). =head2 [@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 C and is useful to use as the basis of the argument for C. Returns a single array reference. =head1 BUGS No bugs are known, but it doesn't mean there aren't any. =head1 SEE ALSO There's an article about this module in the Perl Advent Calendar of 2006: L. L is the core module for traversing files in perl, which has several limitations. L, L, L and the unmaintained L are alternatives to this module. =head1 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: 1. The GNU General Public License Version 2.0 - http://www.opensource.org/licenses/gpl-license.php 2. The Artistic License Version 2.0 - http://www.perlfoundation.org/legal/licenses/artistic-2_0.html 3. At your option - any later version of either or both of these licenses. =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 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. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L =item * 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. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 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 :) L git clone git://github.com/shlomif/perl-file-find-object.git =head1 AUTHOR Shlomi Fish =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =head1 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) =cut Run000755000764000764 013614051520 17127 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/inc/TestBuilder.pm100644000764000764 340213614051520 21212 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/inc/Test/Runpackage Test::Run::Builder; use strict; use warnings; use Module::Build; use vars qw(@ISA); @ISA = (qw(Module::Build)); sub ACTION_runtest { my ($self) = @_; my $p = $self->{properties}; $self->depends_on('code'); local @INC = @INC; # Make sure we test the module in blib/ unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'), File::Spec->catdir($p->{base_dir}, $self->blib, 'arch')); $self->do_test_run_tests; } sub ACTION_distruntest { my ($self) = @_; $self->depends_on('distdir'); my $start_dir = $self->cwd; my $dist_dir = $self->dist_dir; chdir $dist_dir or die "Cannot chdir to $dist_dir: $!"; # XXX could be different names for scripts $self->run_perl_script('Build.PL') # XXX Should this be run w/ --nouse-rcfile or die "Error executing 'Build.PL' in dist directory: $!"; $self->run_perl_script('Build') or die "Error executing 'Build' in dist directory: $!"; $self->run_perl_script('Build', [], ['runtest']) or die "Error executing 'Build test' in dist directory"; chdir $start_dir; } sub do_test_run_tests { my $self = shift; require Test::Run::CmdLine::Iface; my $test_run = Test::Run::CmdLine::Iface->new( { 'test_files' => [glob("t/*.t")], } # 'backend_params' => $self->_get_backend_params(), ); return $test_run->run(); } sub ACTION_tags { my $self = shift; return $self->do_system( "ctags", qw(-f tags --recurse --totals --exclude=blib/** --exclude=t/lib/** --exclude=**/.svn/** --exclude='*~'), "--exclude=".$self->dist_name()."-*/**", qw(--languages=Perl --langmap=Perl:+.t) ); } 1; pod-coverage.t100644000764000764 33413614051520 21510 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/author#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); cpan-changes.t100644000764000764 34413614051520 21603 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/releaseuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; trailing-space.t100644000764000764 103413614051520 22173 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/xt/release#!perl use strict; use warnings; use Test::More; eval "use Test::TrailingSpace"; if ($@) { plan skip_all => "Test::TrailingSpace required for trailing space test."; } else { plan tests => 1; } # TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly # some other stuff. my $finder = Test::TrailingSpace->new( { root => '.', filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#, }, ); # TEST $finder->no_trailing_space( "No trailing space was found." ); Object000755000764000764 013614051520 20406 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/File/FindBase.pm100644000764000764 1110113614051520 21770 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/File/Find/Objectpackage File::Find::Object::Base; $File::Find::Object::Base::VERSION = '0.3.5'; use strict; use warnings; use integer; # TODO : # _last_dir_scanned should be defined only for ::PathComp , but we should # add a regression test to test it. # use Class::XSAccessor accessors => { ( map { $_ => $_ } ( qw( _last_dir_scanned ) ) ) }; use File::Spec; # Create a _copy method that does a flat copy of an array returned by # a method as a reference. sub _make_copy_methods { my ( $pkg, $methods ) = @_; ## no critic no strict 'refs'; foreach my $method (@$methods) { *{ $pkg . "::" . $method . "_copy" } = do { my $m = $method; sub { my $self = shift; return [ @{ $self->$m(@_) } ]; }; }; } ## use critic return; } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::Find::Object::Base - base class for File::Find::Object =head1 VERSION version 0.3.5 =head1 DESCRIPTION This is the base class for F::F::O classes. It only defines some accessors, and is for File::Find::Object's internal use. =head1 METHODS =head1 SEE ALSO L =head1 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: 1. The GNU General Public License Version 2.0 - http://www.opensource.org/licenses/gpl-license.php 2. The Artistic License Version 2.0 - http://www.perlfoundation.org/legal/licenses/artistic-2_0.html 3. At your option - any later version of either or both of these licenses. =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 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. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L =item * 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. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 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 :) L git clone git://github.com/shlomif/perl-file-find-object.git =head1 AUTHOR Shlomi Fish =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =head1 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) =cut Result.pm100644000764000764 1315213614051520 22404 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/File/Find/Objectpackage File::Find::Object::Result; $File::Find::Object::Result::VERSION = '0.3.5'; use strict; use warnings; use integer; use Class::XSAccessor accessors => { ( map { $_ => $_ } ( qw( base basename is_dir is_file is_link path dir_components stat_ret ) ) ) }; use Fcntl qw(:mode); sub new { my $class = shift; my $self = shift; bless $self, $class; return $self; } sub full_components { my $self = shift; return [ @{ $self->dir_components() }, ( $self->is_dir() ? () : $self->basename() ), ]; } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::Find::Object::Result - a result class for File::Find::Object =head1 VERSION version 0.3.5 =head1 DESCRIPTION This is a class returning a single L result as returned by its next_obj() method. =head1 METHODS =head2 File::Find::Object::Result->new({%args}); Initializes a new object from %args. For internal use. =head2 $result->base() Returns the base directory from which searching began. =head2 $result->path() Returns the full path of the result. As such C<< $ffo->next_obj()->path() >> is equivalent to C<< $ffo->next() >> . =head2 $result->is_dir() Returns true if the result refers to a directory. =head2 $result->is_file() Returns true if the result refers to a plain file (equivalent to the Perl C<-f> operator). =head2 $result->is_link() Returns true if the result is a symbolic link. =head2 $result->dir_components() The components of the directory part of the path starting from base() (also the full path if the result is a directory) as an array reference. =head2 $result->basename() Returns the basename of the file (if it is a file and not a directory.) Otherwise - undef(). =head2 $result->full_components() Returns the full components of the result with the basename if it is a file. Returns a single array reference. =head2 $result->stat_ret() The return value of L for the result, placed inside an array reference. This is calculated by L and kept here for convenience and for internal use. =head1 SEE ALSO L =head1 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: 1. The GNU General Public License Version 2.0 - http://www.opensource.org/licenses/gpl-license.php 2. The Artistic License Version 2.0 - http://www.perlfoundation.org/legal/licenses/artistic-2_0.html 3. At your option - any later version of either or both of these licenses. =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 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. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L =item * 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. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 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 :) L git clone git://github.com/shlomif/perl-file-find-object.git =head1 AUTHOR Shlomi Fish =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =head1 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) =cut bump-version-number.pl100644000764000764 116213614051520 22773 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/scripts#!/usr/bin/perl use strict; use warnings; use File::Find::Object; use IO::All; my $tree = File::Find::Object->new( {}, 'lib/' ); my $version_n = shift(@ARGV); if ( !defined($version_n) ) { die "Specify version number as an argument! bump-version-number.pl '0.0.1'"; } while ( my $r = $tree->next() ) { if ( $r =~ m{/\.svn\z} ) { $tree->prune(); } elsif ( $r =~ m{\.pm\z} ) { my @lines = io->file($r)->getlines(); foreach (@lines) { s#(\$VERSION = '|^Version )v?\d+\.\d+(?:\.\d+)?('|)#$1 . $version_n . $2#e; } io->file($r)->print(@lines); } } PathComp.pm100644000764000764 1414513614051520 22644 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/lib/File/Find/Objectpackage File::Find::Object::PathComp; $File::Find::Object::PathComp::VERSION = '0.3.5'; use strict; use warnings; use integer; use parent 'File::Find::Object::Base'; use Class::XSAccessor accessors => { ( map { $_ => $_ } ( qw( _actions _curr_file _files _last_dir_scanned _open_dir_ret _stat_ret _traverse_to ) ) ) }, getters => { _inodes => '_inodes' }, setters => { _set_inodes => '_inodes' }, ; use File::Spec; __PACKAGE__->_make_copy_methods( [ qw( _files _traverse_to ) ] ); sub _dev { return shift->_stat_ret->[0]; } sub _inode { return shift->_stat_ret->[1]; } sub _is_same_inode { my $self = shift; # $st is an array ref with the return of perldoc -f stat . my $st = shift; # On MS-Windows, all inodes in stat are returned as 0, so we need to # check that both inodes are not zero. This is why there's the # $self->_inode() != 0 check at the end. return ( $self->_dev() == $st->[0] && $self->_inode() == $st->[1] && $self->_inode() != 0 ); } sub _should_scan_dir { my $self = shift; my $dir_str = shift; if ( defined( $self->_last_dir_scanned() ) && ( $self->_last_dir_scanned() eq $dir_str ) ) { return; } else { $self->_last_dir_scanned($dir_str); return 1; } } sub _set_up_dir { my $self = shift; my $dir_str = shift; $self->_files( $self->_calc_dir_files($dir_str) ); $self->_traverse_to( $self->_files_copy() ); return $self->_open_dir_ret(1); } sub _calc_dir_files { my $self = shift; my $dir_str = shift; my $handle; my @files; if ( !opendir( $handle, $dir_str ) ) { # Handle this error gracefully. } else { @files = ( sort { $a cmp $b } File::Spec->no_upwards( readdir($handle) ) ); closedir($handle); } return \@files; } sub _component_open_dir { my $self = shift; my $dir_str = shift; if ( !$self->_should_scan_dir($dir_str) ) { return $self->_open_dir_ret(); } return $self->_set_up_dir($dir_str); } sub _next_traverse_to { my $self = shift; return shift( @{ $self->_traverse_to() } ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::Find::Object::PathComp - base class for File::Find::Object's Path Components =head1 VERSION version 0.3.5 =head1 DESCRIPTION This is the base class for F::F::O's path components. It only defines some accessors, and is for File::Find::Object's internal use. =head1 METHODS =head1 SEE ALSO L =head1 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: 1. The GNU General Public License Version 2.0 - http://www.opensource.org/licenses/gpl-license.php 2. The Artistic License Version 2.0 - http://www.perlfoundation.org/legal/licenses/artistic-2_0.html 3. At your option - any later version of either or both of these licenses. =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 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. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L =item * 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. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 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 :) L git clone git://github.com/shlomif/perl-file-find-object.git =head1 AUTHOR Shlomi Fish =head1 BUGS Please report any bugs or feature requests on the bugtracker website L 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. =head1 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) =cut Object000755000764000764 013614051520 20651 5ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t/lib/File/FindTreeCreate.pm100644000764000764 416613614051520 23401 0ustar00shlomifshlomif000000000000File-Find-Object-0.3.5/t/lib/File/Find/Objectpackage File::Find::Object::TreeCreate; use strict; use warnings; use File::Spec (); sub new { my $class = shift; my $self = {}; bless $self, $class; $self->_initialize(@_); return $self; } sub _initialize { } sub get_path { my $self = shift; my $path = shift; my @components; if ( $path =~ s{^\./}{} ) { push @components, File::Spec->curdir(); } my $is_dir = ( $path =~ s{/$}{} ); push @components, split( /\//, $path ); if ($is_dir) { return File::Spec->catdir(@components); } else { return File::Spec->catfile(@components); } } sub exist { my $self = shift; return ( -e $self->get_path(@_) ); } sub is_file { my $self = shift; return ( -f $self->get_path(@_) ); } sub is_dir { my $self = shift; return ( -d $self->get_path(@_) ); } sub cat { my $self = shift; open my $in, "<", $self->get_path(@_) or return 0; my $data; { local $/; $data = <$in>; } close($in); return $data; } sub ls { my $self = shift; opendir my $dir, $self->get_path(@_) or return; my @files = sort { $a cmp $b } grep { !( ( $_ eq "." ) || ( $_ eq ".." ) ) } readdir($dir); closedir($dir); return \@files; } sub create_tree { my ( $self, $unix_init_path, $tree ) = @_; my $real_init_path = $self->get_path($unix_init_path); return $self->_real_create_tree( $real_init_path, $tree ); } sub _real_create_tree { my ( $self, $init_path, $tree ) = @_; my $name = $tree->{'name'}; if ( $name =~ s{/$}{} ) { my $dir_name = File::Spec->catfile( $init_path, $name ); mkdir($dir_name); if ( exists( $tree->{'subs'} ) ) { foreach my $sub ( @{ $tree->{'subs'} } ) { $self->_real_create_tree( $dir_name, $sub ); } } } else { open my $out, ">", File::Spec->catfile( $init_path, $name ); print {$out} +( exists( $tree->{'contents'} ) ? $tree->{'contents'} : "" ); close($out); } return 0; } 1;