From ec35fb4535dab6bc73ae791c1d59cec087c62c25 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 28 Dec 2012 14:23:28 +0100 Subject: [PATCH] Bug 9328, 7167: Remove the File::Find::Rule dependency F::F::Rule doesn't introduce functionality that is not available to File::Find, just some (admittedly useful) syntactical sugar. Signed-off-by: Kyle M Hall --- C4/Update/Database.pm | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/C4/Update/Database.pm b/C4/Update/Database.pm index eaeb288..3104e4a 100644 --- a/C4/Update/Database.pm +++ b/C4/Update/Database.pm @@ -22,7 +22,7 @@ use Modern::Perl; use C4::Context; use File::Basename; -use File::Find::Rule; +use File::Find; use Digest::MD5; use List::MoreUtils qw/uniq/; use YAML; @@ -60,7 +60,14 @@ sub get_versions_path { sub get_filepath { my ( $version ) = @_; - my @files = File::Find::Rule->file->name( "$version.sql", "$version.pl" ) ->in( ( get_versions_path() ) ); + my @files; + find( + sub{ + return unless $_ =~ m|^$version\.pl$| or $_ =~ m|^$version\.sql$|; + push @files, $File::Find::name; + }, + ( get_versions_path() ) + ); if ( scalar @files != 1 ) { die "This version ($version) returned has ".scalar @files." corresponding, need only 1"; @@ -172,7 +179,14 @@ sub execute_version { sub list_versions_available { my @versions; - my @files = File::Find::Rule->file->name( "*.sql", "*.pl" ) ->in( ( get_versions_path() ) ); + my @files; + find( + sub{ + return unless $_ =~ m|\.pl$| or $_ =~ m|\.sql$|; + push @files, $File::Find::name; + }, + ( get_versions_path() ) + ); for my $f ( @files ) { my @file_infos = fileparse( $f, qr/\.[^.]*/ ); -- 1.7.2.5