generate log file with STDERR output
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 8 Jul 2023 06:49:59 +0000 (08:49 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 8 Jul 2023 07:18:04 +0000 (09:18 +0200)
p.pl

diff --git a/p.pl b/p.pl
index 9940b2c..caed5e9 100755 (executable)
--- a/p.pl
+++ b/p.pl
@@ -10,6 +10,16 @@ my $filename = 'Intervali_Openface_novi_rad_Boris_export.txt';
 
 my $debug = $ENV{DEBUG} || 0;
 
+my $today = strftime("%Y-%m-%dT%H:%M:%S", localtime(time()));
+warn "# today $today";
+
+open(my $err_fh, '>', "out.$today.log");
+local $SIG{__WARN__} = sub {
+       print STDERR @_;
+       print $err_fh @_;
+};
+
+
 sub col2nr {
        my @c = @_;
        my $i = 0;
@@ -60,9 +70,7 @@ sub glob_id {
        }
 }
 
-my $today = strftime("%Y-%m-%dT%H:%M:%S ", localtime(time()));
-warn "# today $today";
-open(my $skipped_input, '>',"skip.$today");
+open(my $skipped_input, '>',"out.$today.skip");
 open(my $out_fh, '>', "out.$today");
 my @out_header;