Bug 8915: Followup FIX QA issues
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 9 Nov 2012 13:11:41 +0000 (14:11 +0100)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 12 Nov 2012 15:03:39 +0000 (10:03 -0500)
Before this patch:
* misc/maintenance/fix_mysql_constraints.pl                                FAIL
    pod                         FAIL
        *** ERROR: unterminated B<...>  in file misc/maintenance/fix_mysql_constraints.pl
    forbidden patterns          OK
    valid                       OK
    critic                      FAIL
        "require" statement with library name as string at line 25, column 12. Use a bareword instead.

+ I add a die on the open statement

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Passed-QA-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
misc/maintenance/fix_mysql_constraints.pl

index 8f311e9..1485140 100755 (executable)
@@ -22,7 +22,8 @@ BEGIN {
     # find Koha's Perl modules
     # test carefully before changing this
     use FindBin;
-    eval { require "$FindBin::Bin/../kohalib.pl" };
+    my $lib = "$FindBin::Bin/../kohalib.pl";
+    eval { require $lib };
 }
 
 use Getopt::Long;
@@ -61,11 +62,8 @@ sub fix_mysql_constraints {
             AND CONSTRAINT_TYPE != 'PRIMARY KEY' ")};
 
     my $base_dir = C4::Context->config('intranetdir');
-    open my $fh, "<", "$base_dir/installer/data/mysql/kohastructure.sql";
-    unless ($fh) {
-        say "Unable to open kohastructure.sql file";
-        exit;
-    }
+    open my $fh, "<", "$base_dir/installer/data/mysql/kohastructure.sql"
+        or die "Unable to open kohastructure.sql file";
 
     my $table_name;
     my $engine_altered;
@@ -159,7 +157,7 @@ Prints this help
 
 Alter tables effectively, otherwise just display the ALTER TABLE directives.
 
-=item B<--alterengine
+=item B<--alterengine>
 
 Prior to add missing constraints, alter table engine to InnoDB.