Hello community, here is the log from the commit of package perl-Path-Class for openSUSE:Factory checked in at 2012-03-01 17:25:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Path-Class (Old) and /work/SRC/openSUSE:Factory/.perl-Path-Class.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Path-Class", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Path-Class/perl-Path-Class.changes 2011-09-23 12:38:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Path-Class.new/perl-Path-Class.changes 2012-03-01 17:25:17.000000000 +0100 @@ -1,0 +2,11 @@ +Mon Feb 27 09:04:53 UTC 2012 - [email protected] + +- updated to 0.25 + - resolve() now croak()s instead of die()s on non-existent file. [Danijel Tašov] + - Added a traverse() method for directories, based on the fmap_cont() + method of Forest::Tree::Pure. It's an alternative to ->recurse, + which allows for more control over how the recursion + happens. [Jesse Luehrs] + - Fixed a grammar error in the docs. [Shlomi Fish] + +------------------------------------------------------------------- Old: ---- Path-Class-0.24.tar.gz New: ---- Path-Class-0.25.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Path-Class.spec ++++++ --- /var/tmp/diff_new_pack.LgDla4/_old 2012-03-01 17:25:20.000000000 +0100 +++ /var/tmp/diff_new_pack.LgDla4/_new 2012-03-01 17:25:20.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Path-Class # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,21 +16,24 @@ # - Name: perl-Path-Class -Version: 0.24 -Release: 1 -License: GPL-1.0+ or Artistic-1.0 +Version: 0.25 +Release: 0 %define cpan_name Path-Class Summary: Cross-platform path specification manipulation -Url: http://search.cpan.org/dist/Path-Class/ +License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl +Url: http://search.cpan.org/dist/Path-Class/ Source: http://www.cpan.org/authors/id/K/KW/KWILLIAMS/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Module::Build) >= 0.3601 +#BuildRequires: perl(Path::Class) +#BuildRequires: perl(Path::Class::Dir) +#BuildRequires: perl(Path::Class::Entity) +#BuildRequires: perl(Path::Class::File) %{perl_requires} %description @@ -95,9 +98,6 @@ ./Build install destdir=%{buildroot} create_packlist=0 %perl_gen_filelist -%clean -%{__rm} -rf %{buildroot} - %files -f %{name}.files %defattr(-,root,root,755) %doc Changes LICENSE README ++++++ Path-Class-0.24.tar.gz -> Path-Class-0.25.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/Build.PL new/Path-Class-0.25/Build.PL --- old/Path-Class-0.24/Build.PL 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/Build.PL 2012-02-16 03:56:28.000000000 +0100 @@ -6,38 +6,41 @@ my %module_build_args = ( - 'build_requires' => { - 'Module::Build' => '0.3601', - 'Test' => '0', - 'Test::More' => '0' + "build_requires" => { + "Module::Build" => "0.3601", + "Test" => 0, + "Test::More" => 0, + "warnings" => 0 }, - 'configure_requires' => { - 'ExtUtils::MakeMaker' => '6.30', - 'Module::Build' => '0.3601' + "configure_requires" => { + "ExtUtils::MakeMaker" => "6.30", + "Module::Build" => "0.3601" }, - 'dist_abstract' => 'Cross-platform path specification manipulation', - 'dist_author' => [ - 'Ken Williams <[email protected]>' + "dist_abstract" => "Cross-platform path specification manipulation", + "dist_author" => [ + "Ken Williams <kwilliams\@cpan.org>" ], - 'dist_name' => 'Path-Class', - 'dist_version' => '0.24', - 'license' => 'perl', - 'module_name' => 'Path::Class', - 'recommends' => {}, - 'recursive_test_files' => 1, - 'requires' => { - 'Carp' => '0', - 'Cwd' => '0', - 'Exporter' => '0', - 'File::Path' => '0', - 'File::Spec' => '0.87', - 'File::Temp' => '0', - 'File::stat' => '0', - 'IO::Dir' => '0', - 'IO::File' => '0', - 'overload' => '0' + "dist_name" => "Path-Class", + "dist_version" => "0.25", + "license" => "perl", + "module_name" => "Path::Class", + "recommends" => {}, + "recursive_test_files" => 1, + "requires" => { + "Carp" => 0, + "Cwd" => 0, + "Exporter" => 0, + "File::Path" => 0, + "File::Spec" => "0.87", + "File::Temp" => 0, + "File::stat" => 0, + "IO::Dir" => 0, + "IO::File" => 0, + "base" => 0, + "overload" => 0, + "strict" => 0 }, - 'script_files' => [] + "script_files" => [] ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/Changes new/Path-Class-0.25/Changes --- old/Path-Class-0.24/Changes 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/Changes 2012-02-16 03:56:28.000000000 +0100 @@ -1,5 +1,16 @@ Revision history for Perl extension Path::Class. +0.25 Wed Feb 15 20:55:30 CST 2012 + + - resolve() now croak()s instead of die()s on non-existent file. [Danijel Tašov] + + - Added a traverse() method for directories, based on the fmap_cont() + method of Forest::Tree::Pure. It's an alternative to ->recurse, + which allows for more control over how the recursion + happens. [Jesse Luehrs] + + - Fixed a grammar error in the docs. [Shlomi Fish] + 0.24 Sat May 28 20:52:39 CDT 2011 - Added a tempfile() method for Dir objects, which provides an @@ -224,7 +235,7 @@ properly. [Michael Schwern] - Fixed a test failure on Win32 (from line 71 of t/01-basic.t). - [reported by Murat �nalan] + [reported by Murat Ünalan] - Rewrote general description of Path::Class in the documentation [suggested by Joshua Keroes] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/INSTALL new/Path-Class-0.25/INSTALL --- old/Path-Class-0.24/INSTALL 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/INSTALL 2012-02-16 03:56:28.000000000 +0100 @@ -1,14 +1,44 @@ - Installation instructions for Path::Class -To install this module, follow the standard steps for installing most -Perl modules: +This is the Perl distribution Path-Class. - perl Makefile.PL - make - make test - make install +Installing Path-Class is straightforward. -Or you may use the CPAN.pm module, which will automatically execute -these steps for you. +## Installation with cpanm - -Ken +If you have cpanm, you only need one line: + + % cpanm Path::Class + +If you are installing into a system-wide directory, you may need to pass the +"-S" flag to cpanm, which uses sudo to install the module: + + % cpanm -S Path::Class + +## Installing with the CPAN shell + +Alternatively, if your CPAN shell is set up, you should just be able to do: + + % cpan Path::Class + +## Manual installation + +As a last resort, you can manually install it. Download the tarball, untar it, +then build it: + + % perl Makefile.PL + % make && make test + +Then install it: + + % make install + +If you are installing into a system-wide directory, you may need to run: + + % sudo make install + +## Documentation + +Path-Class documentation is available as POD. +You can run perldoc from a shell to read the documentation: + + % perldoc Path::Class diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/LICENSE new/Path-Class-0.25/LICENSE --- old/Path-Class-0.24/LICENSE 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/LICENSE 2012-02-16 03:56:28.000000000 +0100 @@ -1,4 +1,4 @@ -This software is copyright (c) 2011 by Ken Williams. +This software is copyright (c) 2012 by Ken Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,21 +12,22 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2011 by Ken Williams. +This software is Copyright (c) 2012 by Ken Williams. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 - GNU GENERAL PUBLIC LICENSE - Version 1, February 1989 + GNU GENERAL PUBLIC LICENSE + Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public @@ -67,7 +68,7 @@ The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which @@ -185,7 +186,7 @@ of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -207,9 +208,9 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - Appendix: How to Apply These Terms to Your New Programs + Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it @@ -235,8 +236,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + Also add information on how to contact you by electronic and paper mail. @@ -270,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2011 by Ken Williams. +This software is Copyright (c) 2012 by Ken Williams. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/MANIFEST new/Path-Class-0.25/MANIFEST --- old/Path-Class-0.24/MANIFEST 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/MANIFEST 2012-02-16 03:56:28.000000000 +0100 @@ -16,4 +16,5 @@ t/02-foreign.t t/03-filesystem.t t/04-subclass.t +t/05-traverse.t t/author-critic.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/META.yml new/Path-Class-0.25/META.yml --- old/Path-Class-0.24/META.yml 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/META.yml 2012-02-16 03:56:28.000000000 +0100 @@ -6,11 +6,12 @@ Module::Build: 0.3601 Test: 0 Test::More: 0 + warnings: 0 configure_requires: ExtUtils::MakeMaker: 6.30 Module::Build: 0.3601 dynamic_config: 0 -generated_by: 'Dist::Zilla version 4.200006, CPAN::Meta::Converter version 2.102400' +generated_by: 'Dist::Zilla version 4.300002, CPAN::Meta::Converter version 2.112150' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -26,8 +27,10 @@ File::stat: 0 IO::Dir: 0 IO::File: 0 + base: 0 overload: 0 + strict: 0 resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Path-Class - repository: http://perl-path-class.googlecode.com/svn/trunk -version: 0.24 + repository: git://github.com/kenahoo/Path-Class.git +version: 0.25 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/Makefile.PL new/Path-Class-0.25/Makefile.PL --- old/Path-Class-0.24/Makefile.PL 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/Makefile.PL 2012-02-16 03:56:28.000000000 +0100 @@ -9,36 +9,39 @@ my %WriteMakefileArgs = ( - 'ABSTRACT' => 'Cross-platform path specification manipulation', - 'AUTHOR' => 'Ken Williams <[email protected]>', - 'BUILD_REQUIRES' => { - 'Module::Build' => '0.3601', - 'Test' => '0', - 'Test::More' => '0' + "ABSTRACT" => "Cross-platform path specification manipulation", + "AUTHOR" => "Ken Williams <kwilliams\@cpan.org>", + "BUILD_REQUIRES" => { + "Module::Build" => "0.3601", + "Test" => 0, + "Test::More" => 0, + "warnings" => 0 }, - 'CONFIGURE_REQUIRES' => { - 'ExtUtils::MakeMaker' => '6.30', - 'Module::Build' => '0.3601' + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => "6.30", + "Module::Build" => "0.3601" }, - 'DISTNAME' => 'Path-Class', - 'EXE_FILES' => [], - 'LICENSE' => 'perl', - 'NAME' => 'Path::Class', - 'PREREQ_PM' => { - 'Carp' => '0', - 'Cwd' => '0', - 'Exporter' => '0', - 'File::Path' => '0', - 'File::Spec' => '0.87', - 'File::Temp' => '0', - 'File::stat' => '0', - 'IO::Dir' => '0', - 'IO::File' => '0', - 'overload' => '0' + "DISTNAME" => "Path-Class", + "EXE_FILES" => [], + "LICENSE" => "perl", + "NAME" => "Path::Class", + "PREREQ_PM" => { + "Carp" => 0, + "Cwd" => 0, + "Exporter" => 0, + "File::Path" => 0, + "File::Spec" => "0.87", + "File::Temp" => 0, + "File::stat" => 0, + "IO::Dir" => 0, + "IO::File" => 0, + "base" => 0, + "overload" => 0, + "strict" => 0 }, - 'VERSION' => '0.24', - 'test' => { - 'TESTS' => 't/*.t' + "VERSION" => "0.25", + "test" => { + "TESTS" => "t/*.t" } ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/README new/Path-Class-0.25/README --- old/Path-Class-0.24/README 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/README 2012-02-16 03:56:28.000000000 +0100 @@ -1,11 +1,11 @@ This archive contains the distribution Path-Class, -version 0.24: +version 0.25: Cross-platform path specification manipulation -This software is copyright (c) 2011 by Ken Williams. +This software is copyright (c) 2012 by Ken Williams. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/SIGNATURE new/Path-Class-0.25/SIGNATURE --- old/Path-Class-0.24/SIGNATURE 2011-05-29 03:53:52.000000000 +0200 +++ new/Path-Class-0.25/SIGNATURE 2012-02-16 03:56:28.000000000 +0100 @@ -1,5 +1,5 @@ This file contains message digests of all files listed in MANIFEST, -signed via the Module::Signature module, version 0.66. +signed via the Module::Signature module, version 0.68. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: @@ -14,28 +14,30 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 ea792bf52b566bff462a76a5d4d50433e0b527ea Build.PL -SHA1 247c8647d187a81327719ee36cf6d4f9703db733 Changes -SHA1 066a2dba8084a0c2a7e4b6996ad21872bc16beb5 INSTALL -SHA1 da0b89eff79e9d5128ab28d63e099b840cca39bf LICENSE -SHA1 52cb7d3f48ff3c95c8459535d1bd6e123ec44501 MANIFEST -SHA1 fb09dac402763a91c50f3e1949a51813f509afdb META.yml -SHA1 ce72ebc3d68832477effb18bc248d92211874f14 Makefile.PL -SHA1 243b575c9d7769d2cfd29c189ec2be8c883c4ece README -SHA1 a6ebbb825cd8d9c406a02ac08f3b7680d5d285f2 dist.ini -SHA1 07aaa412631cc8e6ea4276b3f3ea1fffbe5065f5 lib/Path/Class.pm -SHA1 8d6415121b20b7a701290105646ac48f0f691b5b lib/Path/Class/Dir.pm -SHA1 0549c1d2150621445a31f7688b2f5a878bb662f2 lib/Path/Class/Entity.pm -SHA1 8193c8bd639e4e5c01bbaf4f173970fa3a992507 lib/Path/Class/File.pm +SHA1 b0e7caad5afe531b3c9dbb6946d4d62d40fb64ea Build.PL +SHA1 c019faeb9674c167d60997e6e4321f7de7ac7096 Changes +SHA1 3baefa5156f90435f40c793b7f071e2f89a74006 INSTALL +SHA1 b33df3650303ca968f350ac6a976f34f41762851 LICENSE +SHA1 e0b6ae90f3672e071e3e8d77f1d100dda38e9c24 MANIFEST +SHA1 5aefe0dfeafcb343beb080a3f6c7297131fef7ae META.yml +SHA1 9186a51736835d4795e0ff71dd7e1d1c95fea61d Makefile.PL +SHA1 fb3fff92bcd540665c40fea342f8377c72d5d597 README +SHA1 b56785d5c081896083dc4398194e1286e68371a0 dist.ini +SHA1 58a9698bacf9f6d62356a31a7b10b46b7b411910 lib/Path/Class.pm +SHA1 6240803f25d3c7a5b2589e8a82c3684096e6294c lib/Path/Class/Dir.pm +SHA1 7fd839b0aa96c90489b62504ddf993883dd5575d lib/Path/Class/Entity.pm +SHA1 323141c5eefea8cc3f55f0106f54fd4db508131c lib/Path/Class/File.pm SHA1 212c128d87fa012c36016210e6e9213112fc3c23 t/01-basic.t SHA1 a42f4b07e4c42e7a59b960b13c5466d7cd82e17a t/02-foreign.t SHA1 ff702cdbf0bb4c25959cbc5a5c7db17772b7aa5b t/03-filesystem.t SHA1 a163d4cf70142b45974ed39c78571e7ce2ba5a7f t/04-subclass.t +SHA1 a154070d2cb1369f6cebf4228742edea39c43c63 t/05-traverse.t SHA1 fa45d6e6ab1cd421349dea4ef527bfd5cdc8a09e t/author-critic.t -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.6 (Darwin) +Version: GnuPG/MacGPG2 v2.0.17 (Darwin) +Comment: GPGTools - http://gpgtools.org -iD8DBQFN4acwgrvMBLfvlHYRAmIXAKC4w/k04B/Pm3pj3AUHDLUBxEKmFgCgpr+J -vFWvOuqcL5jRV9XPXUxGOCI= -=+Fzk +iEYEARECAAYFAk88cFsACgkQgrvMBLfvlHboawCgw86uYQhnD3A06Nec9W1ZKD2a +04kAmwbu2yyS2/XXyhHa+ql9R79+V1lS +=UPVQ -----END PGP SIGNATURE----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/dist.ini new/Path-Class-0.25/dist.ini --- old/Path-Class-0.24/dist.ini 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/dist.ini 2012-02-16 03:56:28.000000000 +0100 @@ -1,5 +1,5 @@ name = Path-Class -version = 0.24 +version = 0.25 author = Ken Williams <[email protected]> license = Perl_5 copyright_holder = Ken Williams @@ -17,9 +17,12 @@ [Bugtracker] [Repository] [ModuleBuild] +[InstallGuide] -[CriticTests] +[Test::Perl::Critic] ;[PodCoverageTests] [AutoPrereqs] skip = ^English$ + +[Git::Tag] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/lib/Path/Class/Dir.pm new/Path-Class-0.25/lib/Path/Class/Dir.pm --- old/Path-Class-0.24/lib/Path/Class/Dir.pm 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/lib/Path/Class/Dir.pm 2012-02-16 03:56:28.000000000 +0100 @@ -1,8 +1,8 @@ use strict; package Path::Class::Dir; -BEGIN { - $Path::Class::Dir::VERSION = '0.24'; +{ + $Path::Class::Dir::VERSION = '0.25'; } use Path::Class::File; @@ -138,6 +138,19 @@ rmdir( shift() ); } +sub traverse { + my $self = shift; + my ($callback, @args) = @_; + my @children = $self->children; + return $self->$callback( + sub { + my @inner_args = @_; + return map { $_->traverse($callback, @inner_args) } @children; + }, + @args + ); +} + sub recurse { my $self = shift; my %opts = (preorder => 1, depthfirst => 0, @_); @@ -271,7 +284,7 @@ =head1 VERSION -version 0.24 +version 0.25 =head1 SYNOPSIS @@ -650,6 +663,41 @@ doesn't exist or isn't readable), C<next()> will throw an exception with the value of C<$!>. +=item $dir->traverse( sub { ... }, @args ) + +Calls the given callback for the root, passing it a continuation +function which, when called, will call this recursively on each of its +children. The callback function should be of the form: + + sub { + my ($child, $cont, @args) = @_; + # ... + } + +For instance, to calculate the number of files in a directory, you +can do this: + + my $nfiles = $dir->traverse(sub { + my ($child, $cont) = @_; + return sum($cont->(), ($child->is_dir ? 0 : 1)); + }); + +or to calculate the maximum depth of a directory: + + my $depth = $dir->traverse(sub { + my ($child, $cont, $depth) = @_; + return max($cont->($depth + 1), $depth); + }, 0); + +You can also choose not to call the callback in certain situations: + + $dir->traverse(sub { + my ($child, $cont) = @_; + return if -l $child; # don't follow symlinks + # do something with $child + return $cont->(); + }); + =item $dir->recurse( callback => sub {...} ) Iterates through this directory and all of its children, and all of @@ -696,4 +744,4 @@ Path::Class, Path::Class::File, File::Spec -=cut \ No newline at end of file +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/lib/Path/Class/Entity.pm new/Path-Class-0.25/lib/Path/Class/Entity.pm --- old/Path-Class-0.24/lib/Path/Class/Entity.pm 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/lib/Path/Class/Entity.pm 2012-02-16 03:56:28.000000000 +0100 @@ -1,13 +1,14 @@ use strict; package Path::Class::Entity; -BEGIN { - $Path::Class::Entity::VERSION = '0.24'; +{ + $Path::Class::Entity::VERSION = '0.25'; } use File::Spec 0.87; use File::stat (); use Cwd; +use Carp(); use overload ( @@ -63,7 +64,7 @@ sub resolve { my $self = shift; - die $! unless -e $self; # No such file or directory + Carp::croak($!) unless -e $self; # No such file or directory my $cleaned = $self->new( scalar Cwd::realpath($self->stringify) ); # realpath() always returns absolute path, kind of annoying @@ -96,7 +97,7 @@ =head1 VERSION -version 0.24 +version 0.25 =head1 DESCRIPTION @@ -111,4 +112,4 @@ Path::Class -=cut \ No newline at end of file +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/lib/Path/Class/File.pm new/Path-Class-0.25/lib/Path/Class/File.pm --- old/Path-Class-0.24/lib/Path/Class/File.pm 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/lib/Path/Class/File.pm 2012-02-16 03:56:28.000000000 +0100 @@ -1,8 +1,8 @@ use strict; package Path::Class::File; -BEGIN { - $Path::Class::File::VERSION = '0.24'; +{ + $Path::Class::File::VERSION = '0.25'; } use Path::Class::Dir; @@ -95,6 +95,12 @@ return not -e $file; } +sub traverse { + my $self = shift; + my ($callback, @args) = @_; + return $self->$callback(sub { () }, @args); +} + 1; __END__ @@ -104,7 +110,7 @@ =head1 VERSION -version 0.24 +version 0.25 =head1 SYNOPSIS @@ -315,6 +321,11 @@ The default C<iomode> is C<r>. +=item $file->traverse(sub { ... }, @args) + +Calls the given callback on $file. This doesn't do much on its own, +but see the associated documentation in L<Path::Class::Dir>. + =item $file->remove() This method will remove the file in a way that works well on all @@ -352,4 +363,4 @@ Path::Class, Path::Class::Dir, File::Spec -=cut \ No newline at end of file +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/lib/Path/Class.pm new/Path-Class-0.25/lib/Path/Class.pm --- old/Path-Class-0.24/lib/Path/Class.pm 2011-05-29 03:53:45.000000000 +0200 +++ new/Path-Class-0.25/lib/Path/Class.pm 2012-02-16 03:56:28.000000000 +0100 @@ -1,8 +1,8 @@ use strict; package Path::Class; -BEGIN { - $Path::Class::VERSION = '0.24'; +{ + $Path::Class::VERSION = '0.25'; } { @@ -32,7 +32,7 @@ =head1 VERSION -version 0.24 +version 0.25 =head1 SYNOPSIS @@ -160,7 +160,7 @@ =item * -Some platforms, notably VMS and some older versions of DOS (I think), +On some platforms, notably VMS and some older versions of DOS (I think), all filenames must have an extension. Thus if you create a file called F<foo/bar> and then ask for a list of files in the directory F<foo>, you may find a file called F<bar.> instead of the F<bar> you @@ -185,4 +185,4 @@ Path::Class::Dir, Path::Class::File, File::Spec -=cut \ No newline at end of file +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Path-Class-0.24/t/05-traverse.t new/Path-Class-0.25/t/05-traverse.t --- old/Path-Class-0.24/t/05-traverse.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Path-Class-0.25/t/05-traverse.t 2012-02-16 03:56:28.000000000 +0100 @@ -0,0 +1,51 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Cwd; +use Test::More; +use File::Temp qw(tempdir); + +plan tests => 4; + +use_ok 'Path::Class'; + +my $cwd = getcwd; +my $tmp = dir(tempdir(CLEANUP => 1)); + +# Test recursive iteration through the following structure: +# a +# / \ +# b c +# / \ \ +# d e f +# / \ \ +# g h i +(my $abe = $tmp->subdir(qw(a b e)))->mkpath; +(my $acf = $tmp->subdir(qw(a c f)))->mkpath; +$acf->file('i')->touch; +$abe->file('h')->touch; +$abe->file('g')->touch; +$tmp->file(qw(a b d))->touch; + +my $a = $tmp->subdir('a'); + +my $nnodes = $a->traverse(sub { + my ($child, $cont) = @_; + return sum($cont->(), 1); +}); +is($nnodes, 9); + +my $ndirs = $a->traverse(sub { + my ($child, $cont) = @_; + return sum($cont->(), ($child->is_dir ? 1 : 0)); +}); +is($ndirs, 5); + +my $max_depth = $a->traverse(sub { + my ($child, $cont, $depth) = @_; + return max($cont->($depth + 1), $depth); +}, 0); +is($max_depth, 3); + +sub sum { my $total = 0; $total += $_ for @_; $total } +sub max { my $max = 0; for (@_) { $max = $_ if $_ > $max } $max } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
