From 45e63402a29d03e13babf2d8937b98047df14bfc Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 7 Jan 2017 20:50:29 +0200 Subject: [PATCH] Write debug messages on STDERR --- lastmsg | 4 ++-- lib/App/Lastmsg.pm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lastmsg b/lastmsg index 65b4786..ee7e68a 100755 --- a/lastmsg +++ b/lastmsg @@ -103,8 +103,8 @@ F. See L for more information. =head1 ENVIRONMENT The only recognised environment variable is B, which if -set to a true value causes the script to emit a lot of information -about what it is doing. +set to a true value causes the script to emit a lot of information on +STDERR about what it is doing. =head1 TODO diff --git a/lib/App/Lastmsg.pm b/lib/App/Lastmsg.pm index 8d2cce5..07f71db 100644 --- a/lib/App/Lastmsg.pm +++ b/lib/App/Lastmsg.pm @@ -59,14 +59,14 @@ sub run { for my $folder (@{$config->{inbox}}) { next unless -e $folder; - say "Scanning $folder (inbox)" if $ENV{LASTMSG_DEBUG}; + say STDERR "Scanning $folder (inbox)" if $ENV{LASTMSG_DEBUG}; my $folder = Email::Folder->new($folder); while (my $msg = $folder->next_message) { my ($from) = grep { /^from$/i } $msg->header_names; $from = $msg->header_raw($from); if ($ENV{LASTMSG_DEBUG}) { my $mid = grep { /^message-id$/i } $msg->header_names; - say 'Processing ', $msg->header_raw('Message-ID'), + say STDERR 'Processing ', $msg->header_raw('Message-ID'), " from $from" if $ENV{LASTMSG_DEBUG}; } $process_message->($msg, $from); @@ -75,7 +75,7 @@ sub run { for my $folder (@{$config->{sent}}) { next unless -e $folder; - say "Scanning $folder (sent)" if $ENV{LASTMSG_DEBUG}; + say STDERR "Scanning $folder (sent)" if $ENV{LASTMSG_DEBUG}; my $folder = Email::Folder->new($folder); while (my $msg = $folder->next_message) { my @hdrs = grep { /^(?:to|cc|bcc)$/i } $msg->header_names; @@ -85,7 +85,7 @@ sub run { } if ($ENV{LASTMSG_DEBUG}) { my $mid = grep { /^message-id$/i } $msg->header_names; - say 'Processing ', $msg->header_raw($mid), + say STDERR 'Processing ', $msg->header_raw($mid), ' sent to ', join ',', @people if $ENV{LASTMSG_DEBUG}; } $process_message->($msg, @people); -- 2.30.2