Bug 16685 [QA Followup] - Use Path::Tiny::slurp instead of File::Slurp
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 27 Jun 2016 15:56:58 +0000 (15:56 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 9 Sep 2016 12:53:07 +0000 (12:53 +0000)
Path::Tiny::slurp is considered better to use than File::Slurp.

RM Note: The package version in wheezy is too old, the package version
         in jessie is just fine and should be added to the community
         repo if wheezy will be supported for the coming release.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Installer/PerlDependencies.pm
installer/data/mysql/updatedatabase.pl

index d2e9833..de00fd7 100644 (file)
@@ -842,6 +842,11 @@ our $PERL_DEPS = {
         required => 1,
         min_ver => '0.28',
     },
+    'Path::Tiny' => {
+        usage => 'core',
+        required => 1,
+        min_ver => '0.058',
+    },
 };
 
 1;
index 65153ac..7bf7585 100755 (executable)
@@ -47,7 +47,7 @@ use MARC::File::XML ( BinaryEncoding => 'utf8' );
 
 use File::Path qw[remove_tree]; # perl core module
 use File::Spec;
-use File::Slurp;
+use Path::Tiny;
 
 # FIXME - The user might be installing a new database, so can't rely
 # on /etc/koha.conf anyway.
@@ -12920,7 +12920,7 @@ foreach my $file ( sort readdir $dirh ) {
         my $installer = C4::Installer->new();
         my $rv = $installer->load_sql( $update_dir . $file ) ? 0 : 1;
     } elsif ( $file =~ /\.perl$/ ) {
-        my $code = read_file( $update_dir . $file );
+        my $code = path( $update_dir . $file )->slurp_utf8;
         eval $code;
         say "Atomic update generated errors: $@" if $@;
     }