Bug 6679 - [SIGNED-OFF] fix 4 perlcritic violations in C4/Installer.pm
authorMason James <mtj@kohaaloha.com>
Tue, 26 Jun 2012 14:20:58 +0000 (02:20 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 20 Sep 2012 10:17:03 +0000 (12:17 +0200)
- Bareword file handle opened at line 157, column 13.  See pages 202,204 of
PBP.  (Severity: 5)

- I/O layer ":utf8" used at line 157, column 13.  Use ":encoding(UTF-8)" to get strict validation.  (Severity: 5)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
http://perldoc.perl.org/functions/open.html
    open(my $fh, "<:encoding(UTF-8)", "filename")
        || die "can't open UTF-8 encoded filename: $!";

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Installer.pm

index c1f356f..304698e 100644 (file)
@@ -154,8 +154,8 @@ sub marc_framework_sql_list {
         my @frameworklist;
         map {
             my $name = substr( $_, 0, -4 );
-            open FILE, "<:utf8","$dir/$requirelevel/$name.txt";
-            my $lines = <FILE>;
+            open my $fh, "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
+            my $lines = <$fh>;
             $lines =~ s/\n|\r/<br \/>/g;
             use utf8;
             utf8::encode($lines) unless ( utf8::is_utf8($lines) );
@@ -232,8 +232,8 @@ sub sample_data_sql_list {
         my @frameworklist;
         map {
             my $name = substr( $_, 0, -4 );
-            open FILE, "<:utf8","$dir/$requirelevel/$name.txt";
-            my $lines = <FILE>;
+            open my $fh , "<:encoding(UTF-8)", "$dir/$requirelevel/$name.txt";
+            my $lines = <$fh>;
             $lines =~ s/\n|\r/<br \/>/g;
             use utf8;
             utf8::encode($lines) unless ( utf8::is_utf8($lines) );