Bug 22789: Set non_priority column as boolean in schema
[koha-ffzg.git] / tools / upload-cover-image.pl
index 009c890..1d2922c 100755 (executable)
@@ -104,7 +104,9 @@ if ($fileID) {
     else {
         my $filename = $upload->full_path;
         my $dirname = File::Temp::tempdir( CLEANUP => 1 );
-        unless ( system( "unzip", $filename, '-d', $dirname ) == 0 ) {
+        qx/unzip $filename -d $dirname/;
+        my $exit_code = $?;
+        unless ( $exit_code == 0 ) {
             $error = 'UZIPFAIL';
         }
         else {
@@ -130,8 +132,8 @@ if ($fileID) {
                 else {
                     next;
                 }
-                if ( open( FILE, $file ) ) {
-                    while ( my $line = <FILE> ) {
+                if ( open( my $fh, '<', $file ) ) {
+                    while ( my $line = <$fh> ) {
                         my $delim =
                             ( $line =~ /\t/ ) ? "\t"
                           : ( $line =~ /,/ )  ? ","
@@ -169,7 +171,7 @@ if ($fileID) {
                             undef $srcimage;
                         }
                     }
-                    close(FILE);
+                    close($fh);
                 }
                 else {
                     $error = 'OPNLINK';