Make Sys::Info optional
Change-Id: I53c6857e4e71906d54c2d81a2a0788a70416c1b1
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>.