From d0fbe24ae8da1dda5eed0135e898ea868b9d4f72 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. --- C4/Installer/PerlDependencies.pm | 5 ----- C4/Update/Database.pm | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index 22c12ed..83ba962 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -634,11 +634,6 @@ our $PERL_DEPS = { 'required' => '1', 'min_ver' => '0.22', }, - 'File::Find::Rule' => { - 'usage' => 'Core', - 'required' => '1', - 'min_ver' => '0.33', - }, }; 1; 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.10.4