Subject: | Email::Filter-based scripts need to be easier to test: --dry-run and --verbose |
I'd like a way for my Email::Filter scripts to be more testable. I want to be able to see what it's going to do without it actually doing it. So, if I write a script like (I'm new to Email::Filter and this is very untested; apologies if something looks a little bizarre):
## mailfilter ##
use Email::Filter;
my $filter = Email::Filter->new(emergency => "~/Mail/lost+found");
$filter->accept("~/Mail/perl");
$filter->accept("~/Mail/archives");
...
I'd like to be able to test this something like:
$ ./mailfilter --dry-run --verbose ~/Mail/Inbox
and see output something like:
ACCEPT: From: someone@example.com => ~/Mail/perl
ACCEPT: From: someone@example.com => ~/Mail/backup
...
and thus, a line output for each action taken with a piece of email.
REJECT: From: spammer@example.com REASON: We don't accept spam.
IGNORE: From: anon@example.com
PIPE: From: python-list@python.org COMMAND: listgate python-list
etc.