[boulder.pm] Mail::Audit

Walter Pienciak walter at frii.com
Thu Aug 16 10:15:49 CDT 2001


On Wed, 15 Aug 2001, rise wrote:

> On Wed, 15 Aug 2001, Walter Pienciak wrote:
>
> > Well, putting this in my program works:  =8^0
> >
> > sub Mail::Audit::delete_header { $_[0]->{obj}->head->delete($_[1],$_[2]); }
> >
> > and then I just do a put_header('Subject', $new_subject)
>
> Mail::Audit 1.11 has a replace_header method that should make that
> slightly cleaner (and gain you a few strokes :).

Thanks.  My CPAN module output had been telling me I was
up to date with Mail::Audit.   I wasn't . . .  Maybe it's time
to update CPAN.pm  ;^)

I'm liking Mail::Audit so far, even if just for the familiar
syntax (procmail users will nod here).  One issue is that
get($header) retrieves the entire string.  So get('To') can return
something like

    "'Wilbur Poot'" <wpoot at foobar.com>, <misc at openbsd.org>

which is one big string.   This is a feature or a bug, depending
on the current task.

For example, I build hashes like

my %taggable_To = ( #  Any item here that appears in the To line
                    #  will have the key value added to the beginning
                    #  of the Subject line.
    'misc at openbsd.org'              =>  '[OBSD]',
    'perl-qa at perl.org'              =>  '[QA]',
    'bugtraq at securityfocus.com'     =>  '[BT]',
);

my %bounceable_From = ( #  Mail from any of the keys here will be bounced
                        #  to the sender as undeliverable.  The value, if
                        #  present, will be returned as bounce text.
   'bitch at hell.org'    =>  'I can't hear you!  LA-LA-LA-LA-LA',
   'Jane Doe'          =>  '',
);

But since $to can be that big string above, the programming can't
be as simple as

    if (defined($taggable_To{$to})) { # tag it }

On the other hand, it does make it easy to match on things like
'Jane Doe' in %bounceable_From.

YMMV
HTH
OTOH
RTFM

Walter




More information about the Boulder-pm mailing list