X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FLastmsg.pm;h=8f7be5ed663814c2b79960e88a2d5cf757965b05;hb=77386ee07cb00479bfedc5bbe202393ff8791cdd;hp=8d2cce57eb09d247c336dcd61711c9ed32a58d0d;hpb=8d77279934f4257a0ea5c7f3ac29f99f00f0d5f1;p=app-lastmsg.git diff --git a/lib/App/Lastmsg.pm b/lib/App/Lastmsg.pm index 8d2cce5..8f7be5e 100644 --- a/lib/App/Lastmsg.pm +++ b/lib/App/Lastmsg.pm @@ -12,7 +12,7 @@ use List::Util qw/max/; use POSIX qw/strftime/; our $OUTPUT_FILEHANDLE = \*STDOUT; -our $VERSION = '0.001002'; +our $VERSION = '0.002'; our @DEFAULT_INBOX; push @DEFAULT_INBOX, "/var/mail/$ENV{USER}" if exists $ENV{USER}; @@ -59,15 +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'), - " from $from" if $ENV{LASTMSG_DEBUG}; + my ($mid) = grep { /^message-id$/i } $msg->header_names; + say STDERR 'Processing ', $msg->header_raw($mid), " from $from"; } $process_message->($msg, $from); } @@ -75,7 +74,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; @@ -84,9 +83,9 @@ sub run { @people = (@people, split /,/, $msg->header_raw($hdr)); } if ($ENV{LASTMSG_DEBUG}) { - my $mid = grep { /^message-id$/i } $msg->header_names; - say 'Processing ', $msg->header_raw($mid), - ' sent to ', join ',', @people if $ENV{LASTMSG_DEBUG}; + my ($mid) = grep { /^message-id$/i } $msg->header_names; + say STDERR 'Processing ', $msg->header_raw($mid), + ' sent to ', join ',', @people; } $process_message->($msg, @people); } @@ -134,7 +133,7 @@ Marius Gavrilescu, Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2016 by Marius Gavrilescu +Copyright (C) 2016-2017 by Marius Gavrilescu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or,