File-Find-Wanted-1.00/000755 000765 000024 00000000000 11764255113 014512 5ustar00andystaff000000 000000 File-Find-Wanted-1.00/Changes000644 000765 000024 00000000327 11764255044 016012 0ustar00andystaff000000 000000 Revision history for File-Find-Wanted 1.00 Thu Jun 7 20:49:20 CDT 2012 No changes. Only adds a license. 0.01 Thu Aug 5 23:39:52 CDT 2004 First version, released on an unsuspecting world. File-Find-Wanted-1.00/Makefile.PL000644 000765 000024 00000001671 11764254453 016477 0ustar00andystaff000000 000000 #!/bin/env perl use strict; use warnings; use ExtUtils::MakeMaker; my %parms = ( NAME => 'File::Find::Wanted', AUTHOR => 'Andy Lester ', VERSION_FROM => 'Wanted.pm', ABSTRACT_FROM => 'Wanted.pm', PL_FILES => {}, PREREQ_PM => { 'Test::More' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'File-Find-Wanted-*' }, ); if ( $ExtUtils::MakeMaker::VERSION =~ /^\d\.\d\d$/ and $ExtUtils::MakeMaker::VERSION > 6.30 ) { $parms{LICENSE} = 'artistic_2'; } if ( $ExtUtils::MakeMaker::VERSION ge '6.46' ) { $parms{META_MERGE} = { resources => { bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Find-Wanted', license => 'http://www.opensource.org/licenses/artistic-license-2.0.php', } }; } WriteMakefile( %parms ); File-Find-Wanted-1.00/MANIFEST000644 000765 000024 00000000210 11764252665 015645 0ustar00andystaff000000 000000 Changes MANIFEST META.yml Makefile.PL README.md Wanted.pm t/00.load.t t/pod.t t/pod-coverage.t t/simple.t t/extra/foo.txt t/extra/quinn File-Find-Wanted-1.00/META.yml000644 000765 000024 00000001326 11764255113 015765 0ustar00andystaff000000 000000 --- #YAML:1.0 name: File-Find-Wanted version: 1.00 abstract: More obvious wrapper around File::Find author: - Andy Lester license: artistic_2 distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Test::More: 0 resources: bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Find-Wanted license: http://www.opensource.org/licenses/artistic-license-2.0.php no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 File-Find-Wanted-1.00/README.md000644 000765 000024 00000000371 11764253404 015773 0ustar00andystaff000000 000000 file-find-wanted ================ File::Find::Wanted, a CPAN module for simplifying File::Find 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 v2.0. File-Find-Wanted-1.00/t/000755 000765 000024 00000000000 11764255113 014755 5ustar00andystaff000000 000000 File-Find-Wanted-1.00/Wanted.pm000644 000765 000024 00000004624 11764253174 016305 0ustar00andystaff000000 000000 package File::Find::Wanted; =head1 NAME File::Find::Wanted - More obvious wrapper around File::Find =head1 VERSION Version 1.00 =cut our $VERSION = '1.00'; use strict; use File::Find; our @ISA = qw( Exporter ); our @EXPORT = qw( find_wanted ); =head1 SYNOPSIS File::Find is a great module, except that it doesn't actually find anything. Its C function walks a directory tree and calls a callback function. Unfortunately, the callback function is deceptively called C, which implies that it should return a boolean saying whether you want the file. That's not how it works. Most of the time you call C, you just want to build a list of files. There are other modules that do this for you, most notably Richard Clamp's great L, but in many cases, it's overkill, and you need to learn a new syntax. With the C function, you supply a callback sub and a list of starting directories, but the sub actually should return a boolean saying whether you want the file in your list or not. To get a list of all files ending in F<.jpg>: my @files = find_wanted( sub { -f && /\.jpg$/ }, $dir ); For a list of all directories that are not F or F<.svn>: my @files = find_wanted( sub { -d && !/^(CVS|\.svn)$/ }, $dir ) ); It's easy, direct, and simple. =head1 WHY DO THIS? The cynical may say "that's just the same as doing this": my @files; find( sub { push @files, $File::Find::name if -f && /\.jpg$/ }, $dir ); Sure it is, but File::Find::Wanted makes it more obvious, and saves a line of code. That's worth it to me. I'd like it if find_wanted() made its way into the File::Find distro, but for now, this will do. =head1 FUNCTIONS =head2 find_wanted( I<&wanted>, I<@directories> ) Descends through I<@directories>, calling the I function as it finds each file. The function returns a list of all the files and directories for which the I function returned a true value. This is just a wrapper around C. See L for details on how to modify its behavior. =cut sub find_wanted { my $func = shift; my @files; local $_; find( sub { push @files, $File::Find::name if &$func }, @_ ); return @files; } =head1 COPYRIGHT & 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 v2.0. =cut 1; File-Find-Wanted-1.00/t/00.load.t000644 000765 000024 00000000302 11764253341 016273 0ustar00andystaff000000 000000 #!perl -Tw use Test::More tests => 1; use File::Find::Wanted; diag( "Testing File::Find::Wanted $File::Find::Wanted::VERSION, Perl $], $^X" ); pass( 'All modules loaded' ); done_testing(); File-Find-Wanted-1.00/t/extra/000755 000765 000024 00000000000 11764255113 016100 5ustar00andystaff000000 000000 File-Find-Wanted-1.00/t/pod-coverage.t000644 000765 000024 00000000254 10104577115 017512 0ustar00andystaff000000 000000 #!perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); File-Find-Wanted-1.00/t/pod.t000644 000765 000024 00000000214 10104577116 015716 0ustar00andystaff000000 000000 #!perl -T use Test::More; eval "use Test::Pod 1.14"; plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; all_pod_files_ok(); File-Find-Wanted-1.00/t/simple.t000644 000765 000024 00000000636 10104604105 016422 0ustar00andystaff000000 000000 #!perl -w use Test::More tests => 3; BEGIN { use_ok( 'File::Find::Wanted', qw( find_wanted ) ); } STAR_DOT_T: { my @files = sort( find_wanted( sub { /\.t$/ }, "t/" ) ); my @match = sort( ); is_deeply( \@files, \@match ); } DIRECTORIES: { my @files = sort( find_wanted( sub { -d && !/CVS/ }, "t/" ) ); my @match = sort( qw( t t/extra ) ); is_deeply( \@files, \@match ); } File-Find-Wanted-1.00/t/extra/foo.txt000644 000765 000024 00000000033 10104602133 017401 0ustar00andystaff000000 000000 Quinn is the kooky mookus! File-Find-Wanted-1.00/t/extra/quinn000644 000765 000024 00000000042 10104602114 017131 0ustar00andystaff000000 000000 Quinn Lester is the kooky mookus!