]> iEval git - app-lastmsg.git/blobdiff - lib/App/Lastmsg.pm
Improve tests
[app-lastmsg.git] / lib / App / Lastmsg.pm
index 8d2cce57eb09d247c336dcd61711c9ed32a58d0d..40a3e8a4b89d06c692ef0e62da9e4af92400760e 100644 (file)
@@ -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);
                }
This page took 0.020559 seconds and 4 git commands to generate.