On Tue, Nov 04, 2003 at 01:39:53AM +0100, Peter J. Holzer wrote:
> On 2003-11-04 08:21:10 +1100, Gavin Carr wrote:
> > Can we get Transaction::recipients made into a mutator? i.e. replacing 
> > the current recipient list instead of appending via add_recipients. I 
> > know there will be gnashing of teeth among the purists, but there are 
> > times where directly munging recipients is exactly what is required.
> 
> I needed this for my aliases plugin and added a "clear_recipients"
> method to Transaction. The patch is in the same mail as the aliases
> plugin. 
> 
> In the data_post hook, I then do something like:
> 
>     $transaction->clear_recipients();
>     for (@new_recipients) {
>         $transaction->add_recipient(Mail::Address->new('', $_));
>     }
> 
> Yes, 
>     $transaction->recipients(map {Mail::Address->new('', $_)}
>                                @new_recipients
>                           );
> would be a bit more elegant.

Agreed, and simpler to implement as well. That's a vote for, then; any 
other comments?

Cheers,
Gavin

-- 
Open Fusion P/L - Open Source Business Solutions [ Linux - Perl - Apache ]
ph:  02 9875 5032                        fax: 02 9875 4317
web: http://www.openfusion.com.au        mob: 0403 171712
- Fashion is a variable, but style is a constant - Programming Perl

Reply via email to