Make Sys::Info optional

Change-Id: I53c6857e4e71906d54c2d81a2a0788a70416c1b1
diff --git a/Changes b/Changes
index 72cfff9..2a9e3d6 100644
--- a/Changes
+++ b/Changes
@@ -14,6 +14,7 @@
         - Removed deprecated 'pretty' flag.
         - Fix RWK paragraph handling.
         - Updated 'Clone' dependency in Makefile.
+        - Make Sys::Info optional.
 
 0.40 2020-03-03
         - Fixed XIP parser.
diff --git a/Readme.pod b/Readme.pod
index 2437db9..7cc0d20 100644
--- a/Readme.pod
+++ b/Readme.pod
@@ -28,6 +28,7 @@
 In case everything went well, the C<korapxml2krill> tool will
 be available on your command line immediately.
 Minimum requirement for L<KorAP::XML::Krill> is Perl 5.16.
+Optional support for L<Sys::Info> to calculate available cores.
 In addition to work with zip archives, the C<unzip> tool needs to be present.
 
 =head1 ARGUMENTS
@@ -174,13 +175,6 @@
 Can be set multiple times.
 
 
-=item B<--primary|-p>
-
-Output primary data or not. Defaults to C<true>.
-Can be flagged using C<--no-primary> as well.
-This is I<deprecated>.
-
-
 =item B<--non-word-tokens|-nwt>
 
 Tokenize non-word tokens like word tokens (defined as matching
@@ -207,7 +201,8 @@
 also apply to extraction.
 
 Pass -1, and the value will be set automatically to 5
-times the number of available cores.
+times the number of available cores, in case L<Sys::Info>
+is available.
 This is I<experimental>.
 
 
@@ -238,12 +233,6 @@
 This is I<experimental>.
 
 
-=item B<--pretty|-y>
-
-Pretty print JSON output. Defaults to C<false>.
-This is I<deprecated>.
-
-
 =item B<--gzip|-z>
 
 Compress the output.
@@ -407,6 +396,10 @@
     #Morpho
     #Sentences
 
+  RWK
+    #Morpho
+    #Structure
+
   Sgbr
     #Lemma
     #Morpho
diff --git a/script/korapxml2krill b/script/korapxml2krill
index dd5155e..9b79b47 100644
--- a/script/korapxml2krill
+++ b/script/korapxml2krill
@@ -19,8 +19,6 @@
 use KorAP::XML::Batch::File;
 use Config::Simple;
 use Parallel::ForkManager;
-use Sys::Info;
-use Sys::Info::Constants qw( :device_cpu );
 use File::Glob ':bsd_glob';
 use File::Temp qw/tempdir/;
 use File::Path qw(remove_tree make_path);
@@ -526,7 +524,14 @@
 
 # Auto adjust jobs
 if ($jobs eq '-1') {
-  my $cores = Sys::Info->new->device('CPU')->count;
+  my $cores = 1;
+  if (eval("use Sys::Info; 1;") && eval("use Sys::Info::Constants qw( :device_cpu ); 1;")) {
+    $cores = Sys::Info->new->device('CPU')->count;
+  }
+  else {
+    $log->warn("Unable to determine number of cores");
+  };
+
   $jobs = ceil(5 * $cores);
   $log->info("Run using $jobs jobs on $cores cores");
 };
@@ -1025,6 +1030,7 @@
 In case everything went well, the C<korapxml2krill> tool will
 be available on your command line immediately.
 Minimum requirement for L<KorAP::XML::Krill> is Perl 5.16.
+Optional support for L<Sys::Info> to calculate available cores.
 In addition to work with zip archives, the C<unzip> tool needs to be present.
 
 =head1 ARGUMENTS
@@ -1197,7 +1203,8 @@
 also apply to extraction.
 
 Pass -1, and the value will be set automatically to 5
-times the number of available cores.
+times the number of available cores, in case L<Sys::Info>
+is available.
 This is I<experimental>.