Improve reporting
Change-Id: I968635edbba4d742883feac97cdff1abbc74076b
diff --git a/lib/KorAP/Def.pm b/lib/KorAP/Def.pm
index 811b266..6331ecf 100644
--- a/lib/KorAP/Def.pm
+++ b/lib/KorAP/Def.pm
@@ -350,6 +350,7 @@
$self->{vc} = $vc;
close($fh);
+ return 1;
};
sub to_string {
diff --git a/lib/KorAP/DefList.pm b/lib/KorAP/DefList.pm
index 6141f1a..aa73cd8 100644
--- a/lib/KorAP/DefList.pm
+++ b/lib/KorAP/DefList.pm
@@ -72,23 +72,30 @@
# Open file from copy directory
my $def = KorAP::Def->new(catfile($self->{copy}, $file));
- # Parse
- return unless $def;
+ unless ($def) {
+ warn 'Def ', $file, ' is not defined';
+ # Parse
+ return;
+ };
# warn $file . ' is frozen' if $def->frozen_check;
# return;
- $def->parse or return;
+ unless ($def->parse) {
+ warn 'Def ', $file, ' is not parseable';
+ return;
+ };
# Output
my $out = catfile($self->{output}, $file . '.jsonld');
if (open(my $koral, '>' . $out)) {
+ print "Write ", $out, "\n";
binmode($koral);
print $koral encode('utf-8', $def->to_string);
close($koral);
return;
};
- warn 'Unable to write file ' . $out;
+ warn 'Unable to write file '. $out;
};
sub regex_to_vc {
diff --git a/script/cosmasvc2koralquery b/script/cosmasvc2koralquery
index ae74d94..e674964 100755
--- a/script/cosmasvc2koralquery
+++ b/script/cosmasvc2koralquery
@@ -1,9 +1,9 @@
#!/usr/bin/env perl
use strict;
use warnings;
+use lib 'lib';
use KorAP::Def;
use KorAP::DefList;
-use lib 'lib';
use Getopt::Long;
binmode(STDERR, ':encoding(UTF-8)');