use POSIX qw/strftime/;
our $OUTPUT_FILEHANDLE = \*STDOUT;
-our $VERSION = '0.001002';
+our $VERSION = '0.002001';
our @DEFAULT_INBOX;
push @DEFAULT_INBOX, "/var/mail/$ENV{USER}" if exists $ENV{USER};
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);
}
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;
@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);
}
=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,