Fixed exit codes in script

Change-Id: Id2759189efabd793fb00c795cf3e7d3d38720319
diff --git a/Changes b/Changes
index 9774d6f..61aeaba 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.31 2017-06-29
+        - Fixed exit codes in script.
+
 0.30 2017-06-19
         - Fixed permission handling in test suite.
         - Added preliminary CMC support.
diff --git a/lib/KorAP/XML/Krill.pm b/lib/KorAP/XML/Krill.pm
index 7bccbd8..bb30a2d 100644
--- a/lib/KorAP/XML/Krill.pm
+++ b/lib/KorAP/XML/Krill.pm
@@ -16,7 +16,7 @@
 use Data::Dumper;
 use File::Spec::Functions qw/catdir catfile catpath splitdir splitpath rel2abs/;
 
-our $VERSION = '0.30';
+our $VERSION = '0.31';
 
 has 'path';
 has [qw/text_sigle doc_sigle corpus_sigle/];
diff --git a/script/korapxml2krill b/script/korapxml2krill
index b183815..98a41be 100644
--- a/script/korapxml2krill
+++ b/script/korapxml2krill
@@ -116,9 +116,12 @@
 #
 # 2017/06/19
 # - added support for DCK
+#
+# 2017/06/29
+# - Fixed exit codes
 # ----------------------------------------------------------
 
-our $LAST_CHANGE = '2017/06/19';
+our $LAST_CHANGE = '2017/06/29';
 our $LOCAL = $FindBin::Bin;
 our $VERSION_MSG = <<"VERSION";
 Version $KorAP::XML::Krill::VERSION - diewald\@ids-mannheim.de - $LAST_CHANGE
@@ -355,8 +358,8 @@
 if ($cmd eq 'serial') {
 
   if ($output && (!defined($to_tar)) && (!-e $output || !-d $output)) {
-    print "Directory '$output' does not exist.\n\n";
-    exit(0);
+    $log->error("Directory '$output' does not exist.");
+    exit 1;
   };
 
   # Remove all inputs
@@ -391,7 +394,7 @@
     unless ($to_tar) {
       if (make_path($new_out) == 0 && !-d $new_out) {
         $log->error("Can\'t create path $new_out");
-        exit(0);
+        exit 1;
       };
     };
 
@@ -403,7 +406,7 @@
     system @archive_cmd;
   };
 
-  exit(0);
+  exit;
 };
 
 my %skip;
@@ -565,8 +568,8 @@
 
 if ($cmd) {
   if ($output && (!defined($to_tar)) && (!-e $output || !-d $output)) {
-    print "Directory '$output' does not exist.\n\n";
-    exit(0);
+    $log->error("Directory '$output' does not exist.");
+    exit 1;
   };
 };
 
@@ -621,7 +624,7 @@
   unlink($cache_file) if $cache_delete;
 
   stop_time;
-  exit(1);
+  exit;
 };
 
 
@@ -633,8 +636,8 @@
 
     # Check zip capabilities
     unless ($archive->test_unzip) {
-      print "Unzip is not installed or incompatible.\n\n";
-      exit(0);
+      $log->error("Unzip is not installed or incompatible.");
+      exit 1;
     };
 
     # Add further annotation archived
@@ -726,7 +729,7 @@
   # Can't create archive object
   else {
     $log->error('Unable to extract from primary archive ' . $input[0]);
-    exit(1);
+    exit 1;
   };
 }
 
@@ -744,8 +747,8 @@
 
       # Check zip capabilities
       unless ($archive->test_unzip) {
-        print "Unzip is not installed or incompatible.\n\n";
-        exit(0);
+        $log->error("Unzip is not installed or incompatible.");
+        exit 1;
       };
 
       # Add further annotation archived
@@ -767,14 +770,14 @@
       else {
         $log->error('Unable to extract from primary archive ' . $input[0] .
                       ' to ' . $extract_dir);
-        exit(1);
+        exit 1;
       };
     }
 
     # Can't create archive object
     else {
       $log->error('Unable to extract from primary archive ' . $input[0]);
-      exit(1);
+      exit 1;
     };
   };
 
@@ -911,8 +914,8 @@
   elsif (-f($input[0]) && (my $archive = KorAP::XML::Archive->new($input[0]))) {
 
     unless ($archive->test_unzip) {
-      print "Unzip is not installed or incompatible.\n\n";
-      exit(1);
+      $log->error("Unzip is not installed or incompatible.");
+      exit 1;
     };
 
     # Add further annotation archived