From ddff6a6f46b26df075ebe2184f66ef23fa0e3e03 Mon Sep 17 00:00:00 2001 From: Gerhard Gonter <ggonter@gmail.com> Date: Mon, 2 Sep 2019 15:32:13 +0200 Subject: [PATCH] some debugging code --- modules/util/Util/JSON.pm | 3 +-- modules/util/Util/Matrix.pm | 10 +++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/util/Util/JSON.pm b/modules/util/Util/JSON.pm index 60a7d04..23a7449 100755 --- a/modules/util/Util/JSON.pm +++ b/modules/util/Util/JSON.pm @@ -51,11 +51,10 @@ sub write_json_file =begin comment - open (J, '>:utf8', $json_fnm) or die ("can not write to [$json_fnm]"); + open (J, '>:utf8', $json_fnm) or die ("can not write to [$json_fnm]; caller:", join (' ', caller())); syswrite (J, $json_str); close (J); - =end comment =cut diff --git a/modules/util/Util/Matrix.pm b/modules/util/Util/Matrix.pm index eb06331..98ed31b 100644 --- a/modules/util/Util/Matrix.pm +++ b/modules/util/Util/Matrix.pm @@ -204,12 +204,16 @@ sub save_as_csv my $eol= shift || "\n"; my $utf8= shift || 0; - unless (open (FO, '>' . $fnm)) + unless (open (FO, '>', $fnm)) { print "ATTN: cant save as csv [$fnm]\n"; return undef; } - binmode (FO, ':utf8') if ($utf8); + if ($utf8) + { + print "ATTN: binmode :utf8 [$fnm]\n"; + binmode (FO, ':utf8'); + } print FO join ($csv_sep, @$column_names), $eol; my $lines= 0; @@ -238,7 +242,7 @@ sub save_hash_as_csv my $eol= shift || "\n"; my $utf8= shift || 0; - unless (open (FO, '>' . $fnm)) + unless (open (FO, '>', $fnm)) { print "ATTN: cant save as csv [$fnm]\n"; return undef; -- GitLab