Hello community, here is the log from the commit of package perl-File-Next for openSUSE:Factory checked in at 2013-06-06 13:13:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-File-Next (Old) and /work/SRC/openSUSE:Factory/.perl-File-Next.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-File-Next" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-File-Next/perl-File-Next.changes 2011-11-21 12:39:57.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-File-Next.new/perl-File-Next.changes 2013-06-06 13:13:13.000000000 +0200 @@ -1,0 +2,34 @@ +Wed Jun 5 14:04:00 UTC 2013 - [email protected] + +- license update: Artistic-2.0 + See Readme.md + +------------------------------------------------------------------- +Tue Jun 4 08:55:23 UTC 2013 - [email protected] + +- updated to 1.12 + [FIXES] + Fix detection of named pipes under various flavors of BSD. + + + [ENHANCEMENTS] + Added the warning_handler argument to File::Next::from_file(). + This is so from_file() can throw a warning if a non-existent + file is in the file it came from. + + [FIXES] + from_file() should return undef if the file can't be opened. + + Fixed test failures and made tests more portable. + + + [ENHANCEMENTS] + Added File::Next::from_file() to get the list of files to iterate + over from a file, or from STDIN. + + Named pipes are now supported. + + [INTERNAL] + Add more tests, and clean up some Perl::Critic warnings. + +------------------------------------------------------------------- Old: ---- File-Next-1.06.tar.gz New: ---- File-Next-1.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-File-Next.spec ++++++ --- /var/tmp/diff_new_pack.6GXGdP/_old 2013-06-06 13:13:14.000000000 +0200 +++ /var/tmp/diff_new_pack.6GXGdP/_new 2013-06-06 13:13:14.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-File-Next # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 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 @@ -15,43 +15,33 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - -%bcond_with pod Name: perl-File-Next +Version: 1.12 +Release: 0 %define cpan_name File-Next -Summary: File::Next Perl module -Version: 1.06 -Release: 3 -License: GPL-1.0+ or Artistic-1.0 +Summary: File-finding iterator +License: Artistic-2.0 Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/File-Next/ -#Source: http://search.cpan.org/CPAN/authors/id/P/PE/PETDANCE/File-Next-1.06.tar.gz -Source: %{cpan_name}-%{version}.tar.gz +Source: http://www.cpan.org/authors/id/P/PE/PETDANCE/%{cpan_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build -%{perl_requires} BuildRequires: perl BuildRequires: perl-macros -%if %{with pod} -BuildRequires: perl(Test::Pod) >= 1.14 -BuildRequires: perl(Test::Pod::Coverage) >= 1.14 -%endif -BuildRequires: perl(Test::More) -BuildRequires: perl(File::Spec) -# -Requires: perl(File::Spec) +BuildRequires: perl(Test::More) >= 0.88 +#BuildRequires: perl(File::Next) +#BuildRequires: perl(Util) +Requires: perl(Test::More) >= 0.88 +%{perl_requires} %description -File::Next is an iterator-based module for finding files. It's -lightweight, has no dependencies, runs under taint mode, and puts your -program more directly in control of file selection. +File-finding iterator %prep %setup -q -n %{cpan_name}-%{version} %build -%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" +%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" %{__make} %{?_smp_mflags} %check @@ -60,17 +50,10 @@ %install %perl_make_install %perl_process_packlist +%perl_gen_filelist -%clean -%{__rm} -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root,-) -%doc Changes README -%dir %{perl_vendorlib}/File -%{perl_vendorlib}/File/Next.pm -%dir %{perl_vendorarch}/auto/File -%{perl_vendorarch}/auto/File/Next -%doc %{perl_man3dir}/File::Next.%{perl_man3ext}* +%files -f %{name}.files +%defattr(-,root,root,755) +%doc Changes README.md %changelog ++++++ File-Next-1.06.tar.gz -> File-Next-1.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/Changes new/File-Next-1.12/Changes --- old/File-Next-1.06/Changes 2009-08-04 22:11:08.000000000 +0200 +++ new/File-Next-1.12/Changes 2012-12-22 22:22:40.000000000 +0100 @@ -3,6 +3,34 @@ File::Next does NOT use rt.cpan.org for bug tracking. Please report problems at http://github.com/petdance/file-next/issues. +1.12 Sat Dec 22 15:22:31 CST 2012 + [FIXES] + Fix detection of named pipes under various flavors of BSD. + + +1.10 Thu Jun 14 19:55:57 CDT 2012 + [ENHANCEMENTS] + Added the warning_handler argument to File::Next::from_file(). + This is so from_file() can throw a warning if a non-existent + file is in the file it came from. + + [FIXES] + from_file() should return undef if the file can't be opened. + + Fixed test failures and made tests more portable. + + +1.08 Sun May 20 22:43:19 CDT 2012 + [ENHANCEMENTS] + Added File::Next::from_file() to get the list of files to iterate + over from a file, or from STDIN. + + Named pipes are now supported. + + [INTERNAL] + Add more tests, and clean up some Perl::Critic warnings. + + 1.06 Tue Aug 4 15:10:34 CDT 2009 [FIXES] Fixed closing =cut in POD. @@ -162,4 +190,3 @@ 0.01 Sat Jul 29 22:29:46 CDT 2006 First version, released on an unsuspecting world. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/MANIFEST new/File-Next-1.12/MANIFEST --- old/File-Next-1.06/MANIFEST 2009-08-04 22:11:48.000000000 +0200 +++ new/File-Next-1.12/MANIFEST 2012-12-22 22:23:31.000000000 +0100 @@ -1,7 +1,8 @@ +README.md + Changes MANIFEST Makefile.PL -README Next.pm perlcriticrc @@ -11,12 +12,19 @@ t/dirs.t t/dot.t t/everything.t +t/filelist.txt +t/filelist-nul.txt +t/first-and-last-lines-via-process-pipe.pl t/follow.t +t/from_file.t +t/from_stdin.t t/methods.t +t/named-pipe.t t/parms.t t/pod-coverage.t t/pod.t t/sort.t +t/stdin-iterator.pl t/zero.t t/Util.pm @@ -38,4 +46,5 @@ t/swamp/b/b2 t/swamp/c/c1 t/swamp/c/c2 -META.yml Module meta-data (added by MakeMaker) +META.yml Module YAML meta-data (added by MakeMaker) +META.json Module JSON meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/META.json new/File-Next-1.12/META.json --- old/File-Next-1.06/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/META.json 2012-12-22 22:23:31.000000000 +0100 @@ -0,0 +1,53 @@ +{ + "abstract" : "File-finding iterator", + "author" : [ + "Andy Lester <[email protected]>" + ], + "dynamic_config" : 1, + "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112621", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "File-Next", + "no_index" : { + "directory" : [ + "t", + "inc" + ] + }, + "prereqs" : { + "build" : { + "requires" : { + "ExtUtils::MakeMaker" : 0 + } + }, + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : 0 + } + }, + "runtime" : { + "requires" : { + "File::Spec" : 0, + "Test::More" : "0.88" + } + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "http://github.com/petdance/file-next/issues" + }, + "license" : [ + "http://dev.perl.org/licenses/" + ], + "repository" : { + "url" : "http://github.com/petdance/file-next/tree/master" + } + }, + "version" : "1.12" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/META.yml new/File-Next-1.12/META.yml --- old/File-Next-1.06/META.yml 2009-08-04 22:11:48.000000000 +0200 +++ new/File-Next-1.12/META.yml 2012-12-22 22:23:31.000000000 +0100 @@ -1,27 +1,27 @@ ---- #YAML:1.0 -name: File-Next -version: 1.06 -abstract: File-finding iterator +--- +abstract: 'File-finding iterator' author: - - Andy Lester <[email protected]> -license: perl -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 + - 'Andy Lester <[email protected]>' build_requires: - ExtUtils::MakeMaker: 0 + ExtUtils::MakeMaker: 0 +configure_requires: + ExtUtils::MakeMaker: 0 +dynamic_config: 1 +generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.112621' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 +name: File-Next +no_index: + directory: + - t + - inc requires: - File::Spec: 0 - Test::More: 0 + File::Spec: 0 + Test::More: 0.88 resources: - bugtracker: http://github.com/petdance/file-next/issues - license: http://dev.perl.org/licenses/ - repository: http://github.com/petdance/file-next/tree/master -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.50 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + bugtracker: http://github.com/petdance/file-next/issues + license: http://dev.perl.org/licenses/ + repository: http://github.com/petdance/file-next/tree/master +version: 1.12 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/Makefile.PL new/File-Next-1.12/Makefile.PL --- old/File-Next-1.06/Makefile.PL 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/Makefile.PL 2012-12-22 21:48:03.000000000 +0100 @@ -13,7 +13,7 @@ ABSTRACT_FROM => 'Next.pm', PL_FILES => {}, PREREQ_PM => { - 'Test::More' => 0, + 'Test::More' => 0.88, 'File::Spec' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/Next.pm new/File-Next-1.12/Next.pm --- old/File-Next-1.06/Next.pm 2009-08-04 22:11:06.000000000 +0200 +++ new/File-Next-1.12/Next.pm 2012-12-22 22:22:24.000000000 +0100 @@ -9,11 +9,11 @@ =head1 VERSION -Version 1.06 +Version 1.12 =cut -our $VERSION = '1.06'; +our $VERSION = '1.12'; =head1 SYNOPSIS @@ -81,6 +81,26 @@ file, whether it's a regular file, directory, symlink, socket, or whatever. +=head2 from_file( [ \%options, ] $filename ) + +Returns an iterator that iterates over each of the files specified +in I<$filename>. If I<$filename> is C<->, then the files are read +from STDIN. + +The files are assumed to be in the file one filename per line. If +I<$nul_separated> is passed, then the files are assumed to be +NUL-separated, as by C<find -print0>. + +If there are blank lines or empty filenames in the input stream, +they are ignored. + +Each filename is checked to see that it is a regular file or a named +pipe. If the file does not exists or is a directory, then a warning +is thrown to I<warning_handler>, and the file is skipped. + +The following options have no effect in C<from_files>: I<descend_filter>, +I<sort_files>, I<follow_symlinks>. + =head1 SUPPORT FUNCTIONS =head2 sort_standard( $a, $b ) @@ -172,7 +192,14 @@ =head2 error_handler => \&error_handler If I<error_handler> is set, then any errors will be sent through -it. By default, this value is C<CORE::die>. +it. By default, this value is C<CORE::die>. This function must +NOT return. + +=head2 warning_handler => \&warning_handler + +If I<warning_handler> is set, then any errors will be sent through +it. By default, this value is C<CORE::warn>. Unlike the +I<error_handler>, this function must return. =head2 sort_files => [ 0 | 1 | \&sort_sub] @@ -199,11 +226,16 @@ speed hit, because File::Next must check to see if the file or directory you're about to follow is actually a symlink. +=head2 nul_separated => [ 0 | 1 ] + +Used on by the C<from_file> iterator. Specifies that the files +listed in the input file are separated by NUL characters, as from +the C<find> command with the C<-print0> argument. + =cut use File::Spec (); -## no critic (ProhibitPackageVars) our $name; # name of the current file our $dir; # dir of the current file @@ -215,30 +247,32 @@ file_filter => undef, descend_filter => undef, error_handler => sub { CORE::die @_ }, + warning_handler => sub { CORE::warn @_ }, sort_files => undef, follow_symlinks => 1, + nul_separated => 0, ); %skip_dirs = map {($_,1)} (File::Spec->curdir, File::Spec->updir); } sub files { - ($_[0] eq __PACKAGE__) && die 'File::Next::files must not be invoked as File::Next->files'; + die _bad_invocation() if @_ && defined($_[0]) && ($_[0] eq __PACKAGE__); my ($parms,@queue) = _setup( \%files_defaults, @_ ); my $filter = $parms->{file_filter}; return sub { while (@queue) { - my ($dir,$file,$fullpath) = splice( @queue, 0, 3 ); - if ( -f $fullpath ) { + my ($dirname,$file,$fullpath) = splice( @queue, 0, 3 ); ## no critic (ProhibitMagicNumbers) + if ( -f $fullpath || -p $fullpath || $fullpath =~ m{^/dev/fd} ) { if ( $filter ) { local $_ = $file; - local $File::Next::dir = $dir; + local $File::Next::dir = $dirname; local $File::Next::name = $fullpath; next if not $filter->(); } - return wantarray ? ($dir,$file,$fullpath) : $fullpath; + return wantarray ? ($dirname,$file,$fullpath) : $fullpath; } elsif ( -d _ ) { unshift( @queue, _candidate_files( $parms, $fullpath ) ); @@ -251,13 +285,13 @@ sub dirs { - ($_[0] eq __PACKAGE__) && die 'File::Next::dirs must not be invoked as File::Next->dirs'; + die _bad_invocation() if @_ && defined($_[0]) && ($_[0] eq __PACKAGE__); my ($parms,@queue) = _setup( \%files_defaults, @_ ); return sub { while (@queue) { - my (undef,undef,$fullpath) = splice( @queue, 0, 3 ); + my (undef,undef,$fullpath) = splice( @queue, 0, 3 ); ## no critic (ProhibitMagicNumbers) if ( -d $fullpath ) { unshift( @queue, _candidate_files( $parms, $fullpath ) ); return $fullpath; @@ -268,32 +302,89 @@ }; # iterator } - sub everything { - ($_[0] eq __PACKAGE__) && die 'File::Next::everything must not be invoked as File::Next->everything'; + die _bad_invocation() if @_ && defined($_[0]) && ($_[0] eq __PACKAGE__); my ($parms,@queue) = _setup( \%files_defaults, @_ ); my $filter = $parms->{file_filter}; return sub { while (@queue) { - my ($dir,$file,$fullpath) = splice( @queue, 0, 3 ); + my ($dirname,$file,$fullpath) = splice( @queue, 0, 3 ); ## no critic (ProhibitMagicNumbers) if ( -d $fullpath ) { unshift( @queue, _candidate_files( $parms, $fullpath ) ); } if ( $filter ) { local $_ = $file; - local $File::Next::dir = $dir; + local $File::Next::dir = $dirname; local $File::Next::name = $fullpath; next if not $filter->(); } - return wantarray ? ($dir,$file,$fullpath) : $fullpath; + return wantarray ? ($dirname,$file,$fullpath) : $fullpath; } # while return; }; # iterator } +sub from_file { + die _bad_invocation() if @_ && defined($_[0]) && ($_[0] eq __PACKAGE__); + + my ($parms,@queue) = _setup( \%files_defaults, @_ ); + my $err = $parms->{error_handler}; + my $warn = $parms->{error_handler}; + + my $filename = $queue[1]; + + if ( !defined($filename) ) { + $err->( 'Must pass a filename to from_file()' ); + return undef; + } + + my $fh; + if ( $filename eq '-' ) { + $fh = \*STDIN; + } + else { + if ( !open( $fh, '<', $filename ) ) { + $err->( "Unable to open $filename: $!" ); + return undef; + } + } + my $filter = $parms->{file_filter}; + + return sub { + local $/ = $parms->{nul_separated} ? "\x00" : $/; + while ( my $fullpath = <$fh> ) { + chomp $fullpath; + next unless $fullpath =~ /./; + if ( not ( -f $fullpath || -p _ ) ) { + $warn->( "$fullpath: No such file" ); + next; + } + + my ($volume,$dirname,$file) = File::Spec->splitpath( $fullpath ); + if ( $filter ) { + local $_ = $file; + local $File::Next::dir = $dirname; + local $File::Next::name = $fullpath; + next if not $filter->(); + } + return wantarray ? ($dirname,$file,$fullpath) : $fullpath; + } # while + close $fh; + + return; + }; # iterator +} + +sub _bad_invocation { + my $good = (caller(1))[3]; + my $bad = $good; + $bad =~ s/(.+)::/$1->/; + return "$good must not be invoked as $bad"; +} + sub sort_standard($$) { return $_[0]->[1] cmp $_[1]->[1] } ## no critic (ProhibitSubroutinePrototypes) sub sort_reverse($$) { return $_[1]->[1] cmp $_[0]->[1] } ## no critic (ProhibitSubroutinePrototypes) @@ -343,7 +434,7 @@ # Any leftover keys are bogus for my $badkey ( keys %passed_parms ) { - my $sub = (caller(1))[3]; + my $sub = (caller(1))[3]; ## no critic (ProhibitMagicNumbers) $parms->{error_handler}->( "Invalid option passed to $sub(): $badkey" ); } @@ -376,12 +467,12 @@ =cut sub _candidate_files { - my $parms = shift; - my $dir = shift; + my $parms = shift; + my $dirname = shift; my $dh; - if ( !opendir $dh, $dir ) { - $parms->{error_handler}->( "$dir: $!" ); + if ( !opendir $dh, $dirname ) { + $parms->{error_handler}->( "$dirname: $!" ); return; } @@ -394,7 +485,7 @@ my $has_stat; # Only do directory checking if we have a descend_filter - my $fullpath = File::Spec->catdir( $dir, $file ); + my $fullpath = File::Spec->catdir( $dirname, $file ); if ( !$follow_symlinks ) { next if -l $fullpath; $has_stat = 1; @@ -408,10 +499,10 @@ } } if ( $sort_sub ) { - push( @newfiles, [ $dir, $file, $fullpath ] ); + push( @newfiles, [ $dirname, $file, $fullpath ] ); } else { - push( @newfiles, $dir, $file, $fullpath ); + push( @newfiles, $dirname, $file, $fullpath ); } } closedir $dh; @@ -423,6 +514,29 @@ return @newfiles; } +=head1 DIAGNOSTICS + +=over + +=item C<< File::Next::files must not be invoked as File::Next->files >> + +=item C<< File::Next::dirs must not be invoked as File::Next->dirs >> + +=item C<< File::Next::everything must not be invoked as File::Next->everything >> + +=back + +The interface functions do not allow for the method invocation syntax and +throw errors with the messages above. You can work around this limitation +with L<UNIVERSAL/can>. + + for my $file_system_feature (qw(dirs files)) { + my $iterator = File::Next->can($file_system_feature)->($options, $target_directory); + while (defined(my $name = $iterator->())) { + # ... + } + } + =head1 SPEED TWEAKS =over 4 @@ -479,22 +593,18 @@ All file-finding in this module is adapted from Mark Jason Dominus' marvelous I<Higher Order Perl>, page 126. +Thanks also for bug fixes and typo finding to +Bruce Woodward, +Christopher J. Madsen, +Bernhard Fisseni +and Rob Hoelz. + =head1 COPYRIGHT & LICENSE -Copyright 2005-2009 Andy Lester. +Copyright 2005-2012 Andy Lester. This program is free software; you can redistribute it and/or modify -it under the terms of either: - -=over 4 - -=item * the GNU General Public License as published by the Free -Software Foundation; either version 1, or (at your option) any later -version, or - -=item * the Artistic License version 2.0. - -=back +it under the terms of the Artistic License version 2.0. =cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/README new/File-Next-1.12/README --- old/File-Next-1.06/README 2009-07-31 23:30:52.000000000 +0200 +++ new/File-Next-1.12/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,51 +0,0 @@ -File-Next - -File::Next is an iterator-based module for finding files. It's -lightweight, has no dependencies, runs under taint mode, and puts your -program more directly in control of file selection. - -It's taken heavily from Mark Jason Dominus' excellent book "Higher -Order Perl". http://hop.perl.plover.com/ - -INSTALLATION - -To install this module, run the following commands: - - perl Makefile.PL - make - make test - make install - - -SUPPORT AND DOCUMENTATION - -After installing, you can find documentation for this module with the perldoc command. - - perldoc File::Next - -You can also look for information at: - - Search CPAN - http://search.cpan.org/dist/File-Next - - Bug Tracker: - http://github.com/petdance/file-next/issues - - AnnoCPAN, annotated CPAN documentation: - http://annocpan.org/dist/File-Next - - CPAN Ratings: - http://cpanratings.perl.org/d/File-Next - -COPYRIGHT AND LICENSE - -Copyright (C) 2006-2009 Andy Lester - -This program is free software; you can redistribute it and/or modify -it under the terms of either: - - * the GNU General Public License as published by the Free - Software Foundation; either version 1, or (at your option) any - later version, or - - * the Artistic License version 2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/README.md new/File-Next-1.12/README.md --- old/File-Next-1.06/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/README.md 2012-05-07 21:15:33.000000000 +0200 @@ -0,0 +1,49 @@ +File-Next +--------- + +File::Next is an iterator-based module for finding files. It's +lightweight, has no dependencies, runs under taint mode, and puts your +program more directly in control of file selection. + +It's taken heavily from Mark Jason Dominus' excellent book "Higher +Order Perl". http://hop.perl.plover.com/ + +INSTALLATION +------------ + +To install this module, run the following commands: + + perl Makefile.PL + make + make test + make install + + +SUPPORT AND DOCUMENTATION +------------------------- + +After installing, you can find documentation for this module with the perldoc command. + + perldoc File::Next + +You can also look for information at: + +* Search CPAN + * http://search.cpan.org/dist/File-Next + +* Bug Tracker: + * http://github.com/petdance/file-next/issues + +* AnnoCPAN, annotated CPAN documentation: + * http://annocpan.org/dist/File-Next + +* CPAN Ratings: + * http://cpanratings.perl.org/d/File-Next + +COPYRIGHT AND LICENSE +--------------------- + +Copyright 2005-2012 Andy Lester. + +This program is free software; you can redistribute it and/or modify +it under the terms of the Artistic License version 2.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/perlcriticrc new/File-Next-1.12/perlcriticrc --- old/File-Next-1.06/perlcriticrc 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/perlcriticrc 2012-05-07 21:23:16.000000000 +0200 @@ -6,8 +6,11 @@ [-ControlStructures::ProhibitPostfixControls] [-Documentation::RequirePodAtEnd] +[-Documentation::RequirePodLinksIncludeText] [-Documentation::RequirePodSections] +[-ErrorHandling::RequireCarping] + [-Miscellanea::RequireRcsKeywords] [-Modules::RequireVersionVar] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/00-load.t new/File-Next-1.12/t/00-load.t --- old/File-Next-1.06/t/00-load.t 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/00-load.t 2012-05-07 21:39:08.000000000 +0200 @@ -4,8 +4,8 @@ use warnings; use Test::More tests => 1; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; diag( "Testing File::Next $File::Next::VERSION, Perl $], $^X" ); + +pass( 'All modules loaded OK.' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/Util.pm new/File-Next-1.12/t/Util.pm --- old/File-Next-1.06/t/Util.pm 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/Util.pm 2012-05-21 05:15:39.000000000 +0200 @@ -1,5 +1,7 @@ package main; +use File::Next; + sub slurp { my $iter = shift; my @files; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/api.t new/File-Next-1.12/t/api.t --- old/File-Next-1.06/t/api.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/api.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,11 +2,9 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 17; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; CHECK_FILE_FILTER: { my $file_filter = sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/basic.t new/File-Next-1.12/t/basic.t --- old/File-Next-1.06/t/basic.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/basic.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 11; +use Test::More tests => 10; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; # use Test::Differences; # eq_or_diff \@got, [qw( a b c )], "testing arrays"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/dirs.t new/File-Next-1.12/t/dirs.t --- old/File-Next-1.06/t/dirs.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/dirs.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; NO_PARMS: { my $iter = File::Next::dirs( 't/' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/dot.t new/File-Next-1.12/t/dot.t --- old/File-Next-1.06/t/dot.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/dot.t 2012-06-12 05:28:16.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; NO_PARMS: { chdir( 't' ); @@ -25,12 +23,19 @@ dirs.t dot.t everything.t + filelist.txt + filelist-nul.txt + first-and-last-lines-via-process-pipe.pl follow.t + from_file.t + from_stdin.t methods.t + named-pipe.t parms.t pod-coverage.t pod.t sort.t + stdin-iterator.pl Util.pm zero.t swamp/a/a1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/everything.t new/File-Next-1.12/t/everything.t --- old/File-Next-1.06/t/everything.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/everything.t 2012-06-12 05:28:16.000000000 +0200 @@ -2,14 +2,13 @@ use strict; use warnings; -use Test::More tests => 5; + +use Test::More tests => 4; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; NO_PARMS: { my $iter = File::Next::everything( 't/' ); @@ -25,12 +24,19 @@ t/dirs.t t/dot.t t/everything.t + t/filelist.txt + t/filelist-nul.txt + t/first-and-last-lines-via-process-pipe.pl t/follow.t + t/from_file.t + t/from_stdin.t t/methods.t + t/named-pipe.t t/parms.t t/pod-coverage.t t/pod.t t/sort.t + t/stdin-iterator.pl t/swamp t/swamp/0 t/swamp/a Files old/File-Next-1.06/t/filelist-nul.txt and new/File-Next-1.12/t/filelist-nul.txt differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/filelist.txt new/File-Next-1.12/t/filelist.txt --- old/File-Next-1.06/t/filelist.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/filelist.txt 2012-06-12 05:28:16.000000000 +0200 @@ -0,0 +1,16 @@ +t/00-load.t +t/api.t +t/basic.t +t/dirs.t +t/dot.t +t/everything.t +t/follow.t +t/from_file.t +t/methods.t +t/named-pipe.t +t/parms.t +t/pod-coverage.t +t/pod.t +t/sort.t +t/swamp/perl-test.t +t/zero.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/first-and-last-lines-via-process-pipe.pl new/File-Next-1.12/t/first-and-last-lines-via-process-pipe.pl --- old/File-Next-1.06/t/first-and-last-lines-via-process-pipe.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/first-and-last-lines-via-process-pipe.pl 2012-06-12 05:28:16.000000000 +0200 @@ -0,0 +1,21 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use File::Next; + +my ( $input ) = @ARGV; + +my $files = File::Next::files( $input ); +my $file = $files->(); +if ( open my $f, '<', $file ) { + my @lines = <$f>; + print $lines[0]; + print $lines[-1]; + close $f; + exit 0; +} +else { + exit 1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/follow.t new/File-Next-1.12/t/follow.t --- old/File-Next-1.06/t/follow.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/follow.t 2012-05-07 21:39:08.000000000 +0200 @@ -7,16 +7,14 @@ use lib 't'; use Util; -BEGIN { - eval { symlink('',''); 1 } or - plan skip_all => 'System does not support symlinks.'; -} +use File::Next; -BEGIN { - plan tests => 7; - use_ok( 'File::Next' ); +if ( ! eval { symlink('',''); 1 } ) { + plan skip_all => 'System does not support symlinks.'; } +plan tests => 6; + my %links = ( 't/swamp/linkfile' => 'Makefile', 't/swamp/linkdir' => 'a', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/from_file.t new/File-Next-1.12/t/from_file.t --- old/File-Next-1.06/t/from_file.t 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/from_file.t 2012-06-12 05:28:16.000000000 +0200 @@ -0,0 +1,70 @@ +#!perl -T + +use strict; +use warnings; +use Test::More tests => 10; + +use lib 't'; +use Util; + +use File::Next; + +# use Test::Differences; +# eq_or_diff \@got, [qw( a b c )], "testing arrays"; + +my @expected = qw( + t/00-load.t + t/api.t + t/basic.t + t/dirs.t + t/dot.t + t/everything.t + t/follow.t + t/from_file.t + t/methods.t + t/named-pipe.t + t/parms.t + t/pod-coverage.t + t/pod.t + t/sort.t + t/swamp/perl-test.t + t/zero.t +); + + +FROM_FILESYSTEM_FILE: { + my $iter = File::Next::from_file( 't/filelist.txt' ); + isa_ok( $iter, 'CODE' ); + + my @actual = slurp( $iter ); + sets_match( \@actual, \@expected, 'FROM_FILESYSTEM_FILE' ); +} + +FROM_NUL_FILE: { + my $iter = File::Next::from_file( { nul_separated => 1 }, 't/filelist-nul.txt' ); + isa_ok( $iter, 'CODE' ); + + my @actual = slurp( $iter ); + sets_match( \@actual, \@expected, 'FROM_NUL_FILE' ); +} + +FROM_UNSPECIFIED_FILE: { + my $iter; + my $rc = eval { + $iter = File::Next::from_file(); + }; + like( $@, qr/Must pass a filename to from_file/, 'Proper error message' ); + ok( !defined($iter), 'Iterator should be null' ); + ok( !defined($rc), 'Eval should fail' ); +} + +FROM_MISSING_FILE: { + my $iter; + my $rc = eval { + $iter = File::Next::from_file( 'flargle-bargle.txt' ); + }; + + like( $@, qr/\QUnable to open flargle-bargle.txt/, 'Proper error message' ); + ok( !defined($iter), 'Iterator should be null' ); + ok( !defined($rc), 'Eval should fail' ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/from_stdin.t new/File-Next-1.12/t/from_stdin.t --- old/File-Next-1.06/t/from_stdin.t 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/from_stdin.t 2012-06-12 05:28:16.000000000 +0200 @@ -0,0 +1,43 @@ +#!perl + +use strict; +use warnings; +use Test::More tests => 2; + +use lib 't'; +use Util; + +my $CAT = "$^X -pe1"; + +my @expected = qw( + t/00-load.t + t/api.t + t/basic.t + t/dirs.t + t/dot.t + t/everything.t + t/follow.t + t/from_file.t + t/methods.t + t/named-pipe.t + t/parms.t + t/pod-coverage.t + t/pod.t + t/sort.t + t/swamp/perl-test.t + t/zero.t +); + +FROM_STDIN: { + # Pipe stuff into the iterator + my @actual = `$CAT t/filelist.txt | $^X -Mblib t/stdin-iterator.pl`; + chomp @actual; + sets_match( \@actual, \@expected, 'FROM_STDIN' ); +} + +FROM_STDIN_NUL: { + # Pipe nul-separated stuff into the iterator that handles nul-separated + my @actual = `$CAT t/filelist-nul.txt | $^X -Mblib t/stdin-iterator.pl 1`; + chomp @actual; + sets_match( \@actual, \@expected, 'FROM_STDIN_NUL' ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/methods.t new/File-Next-1.12/t/methods.t --- old/File-Next-1.06/t/methods.t 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/methods.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 6; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; EVERYTHING: { my $iter; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/named-pipe.t new/File-Next-1.12/t/named-pipe.t --- old/File-Next-1.06/t/named-pipe.t 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/named-pipe.t 2012-06-12 05:28:16.000000000 +0200 @@ -0,0 +1,37 @@ +#!perl + +use strict; +use warnings; + +use Test::More; + +plan skip_all => q{Windows doesn't have named pipes} if $^O =~ /MSWin32/; +plan tests => 4; + +use POSIX (); + +my $pipename = POSIX::tmpnam(); +POSIX::mkfifo $pipename, 0666; + +my $pid = fork(); +if ( $pid == 0 ) { + open my $fifo, '>', $pipename or die "Couldn't create named pipe $pipename: $!"; + open my $f, '<', 'Changes' or die "Couldn't open Changes: $!"; + while (my $line = <$f>) { + print {$fifo} $line; + } + close $fifo; + close $f; + exit 0; +} + +my @output = qx{$^X -Mblib t/first-and-last-lines-via-process-pipe.pl $pipename}; +is( $?, 0, 'No errors in executing our little named pipe tester' ); +unlink $pipename; + +chomp @output; +is( scalar @output, 2, 'Get exactly 2 lines back' ); +is( $output[0], 'Revision history for File-Next' ); +is( $output[-1], ' First version, released on an unsuspecting world.' ); + +done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/parms.t new/File-Next-1.12/t/parms.t --- old/File-Next-1.06/t/parms.t 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/parms.t 2012-05-21 04:10:04.000000000 +0200 @@ -2,13 +2,10 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 10; -BEGIN { - use_ok( 'File::Next' ); -} - +use File::Next; BAD_PARMS_CAUGHT: { my @errors; @@ -32,13 +29,49 @@ BAD_PARMS_UNCAUGHT: { - eval { + my $bad_iterator = eval { my $iter = File::Next::dirs( { wango => 'ze tango', }, 't/pod.t' ); }; - ok( defined $@, 'Throws an error' ); + ok( !defined($bad_iterator), 'Constructor fails with bad parameters' ); like( $@, qr/Invalid.+dirs.+wango/, 'And it looks reasonable' ); } + +FILES_AS_METHOD: { + my $bad_iterator = eval { + my $iter = + File::Next->files( { + wango => 'ze tango', + }, 't/pod.t' ); + }; + + ok( !defined($bad_iterator), 'Constructor fails with bad parameters' ); + like( $@, qr/File::Next::files must not be invoked as File::Next->files/, 'And it looks reasonable' ); +} + +DIRS_AS_METHOD: { + my $bad_iterator = eval { + my $iter = + File::Next->dirs( { + wango => 'ze tango', + }, 't/pod.t' ); + }; + + ok( !defined($bad_iterator), 'Constructor fails with bad parameters' ); + like( $@, qr/File::Next::dirs must not be invoked as File::Next->dirs/, 'And it looks reasonable' ); +} + +EVERYTHING_AS_METHOD: { + my $bad_iterator = eval { + my $iter = + File::Next->everything( { + wango => 'ze tango', + }, 't/pod.t' ); + }; + + ok( !defined($bad_iterator), 'Constructor fails with bad parameters' ); + like( $@, qr/File::Next::everything must not be invoked as File::Next->everything/, 'And it looks reasonable' ); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/pod-coverage.t new/File-Next-1.12/t/pod-coverage.t --- old/File-Next-1.06/t/pod-coverage.t 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/pod-coverage.t 2012-05-07 21:15:33.000000000 +0200 @@ -2,7 +2,14 @@ use strict; use warnings; + use Test::More; -eval 'use Test::Pod::Coverage 1.04'; ## no critic -plan skip_all => 'Test::Pod::Coverage 1.04 required for testing POD coverage' if $@; -all_pod_coverage_ok(); + +my $module = 'Test::Pod::Coverage 1.04'; + +if ( eval "use $module; 1;" ) { ## no critic (ProhibitStringyEval) + all_pod_coverage_ok(); +} +else { + plan skip_all => "$module required for testing POD"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/pod.t new/File-Next-1.12/t/pod.t --- old/File-Next-1.06/t/pod.t 2009-07-31 16:41:49.000000000 +0200 +++ new/File-Next-1.12/t/pod.t 2012-05-07 21:15:33.000000000 +0200 @@ -2,7 +2,14 @@ use strict; use warnings; + use Test::More; -eval 'use Test::Pod 1.14'; ## no critic -plan skip_all => 'Test::Pod 1.14 required for testing POD' if $@; -all_pod_files_ok(); + +my $module = 'Test::Pod 1.14'; + +if ( eval "use $module; 1;" ) { ## no critic (ProhibitStringyEval) + all_pod_files_ok(); +} +else { + plan skip_all => "$module required for testing POD"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/sort.t new/File-Next-1.12/t/sort.t --- old/File-Next-1.06/t/sort.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/sort.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 6; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; my @sorted_swamp = qw( t/swamp/0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/stdin-iterator.pl new/File-Next-1.12/t/stdin-iterator.pl --- old/File-Next-1.06/t/stdin-iterator.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/File-Next-1.12/t/stdin-iterator.pl 2012-05-21 05:02:37.000000000 +0200 @@ -0,0 +1,13 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +use File::Next; + +my $nul = shift; + +my $iter = File::Next::from_file( { nul_separated => $nul }, '-' ); +while ( my $file = $iter->() ) { + print "$file\n"; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/File-Next-1.06/t/zero.t new/File-Next-1.12/t/zero.t --- old/File-Next-1.06/t/zero.t 2009-08-03 17:05:56.000000000 +0200 +++ new/File-Next-1.12/t/zero.t 2012-05-07 21:39:08.000000000 +0200 @@ -2,14 +2,12 @@ use strict; use warnings; -use Test::More tests => 3; +use Test::More tests => 2; use lib 't'; use Util; -BEGIN { - use_ok( 'File::Next' ); -} +use File::Next; # NOTE! This block does a chdir. If you add more tests after it, you # may be sorry. -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
