Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Filter CPAN distribution.

Report information
The Basics
Id: 25027
Status: resolved
Priority: 0/
Queue: Email-Filter

People
Owner: Nobody in particular
Requestors: perl [...] infotrope.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Keep track of last accept()-ed mailbox for logging
When using an accept() trigger to log details of messages, I found there's no way to find out *where* the message was accepted to, nor any way to pass it around to the log_accept() subroutine. I'd like something like a last_accept() accessor that gives you the name of the folder you last accepted something to.
On Mon Feb 19 00:32:06 2007, SKUD wrote: Show quoted text
> When using an accept() trigger to log details of messages, I found > there's no way to find out *where* the message was accepted to, nor any > way to pass it around to the log_accept() subroutine. I'd like > something like a last_accept() accessor that gives you the name of the > folder you last accepted something to.
Class::Trigger allows additional arguments to be passed to call_trigger, so this is a simple matter of passing @boxes to the call_trigger call. Included patch adds this to the 'before_accept' and 'after_accept' triggers, as well as adding @program to the 'pipe' trigger.
--- lib/Email/Filter.pm 2008-09-14 20:26:26.000000000 -0700 +++ /Users/wnorris/Filter.pm 2009-02-08 13:06:29.000000000 -0800 @@ -266,11 +266,11 @@ sub accept { my ($self, @boxes) = @_; - $self->call_trigger("before_accept"); + $self->call_trigger("before_accept", @boxes); # Unparsing and reparsing is so fast we prefer to do that in order # to keep to LocalDelivery's clean interface. if (Email::LocalDelivery->deliver($self->simple->as_string, @boxes)) { - $self->call_trigger("after_accept"); + $self->call_trigger("after_accept", @boxes); $self->done_ok; } else { $self->fail_gracefully(); @@ -322,7 +322,7 @@ my ($self, @program) = @_; my $stdout; my $string = $self->simple->as_string; - $self->call_trigger("pipe"); + $self->call_trigger("pipe", @program); if (eval {run(\@program, \$string, \$stdout)} ) { $self->done_ok; return $stdout;
Thanks, I have applied this patch (with a small tweak) and credited you, Will. -- rjbs