.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::Filter 3pm" .TH Mail::Filter 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::Filter \- filter mail through multiple subroutines .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Mail::Filter; \& \& my $filter = Mail::Filter\->new( \e&filter1, \e&filter2 ); \& \& my $mail = Mail::Internet\->new( [<>] ); \& my $mail = $filter\->filter($mail); \& \& my $folder = Mail::Folder\->new( .... ); \& my $filter\->filter($folder); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`Mail::Filter\*(C'\fR provides an interface to filtering Email through multiple subroutines. .PP \&\f(CW\*(C`Mail::Filter\*(C'\fR filters mail by calling each filter subroutine in turn. Each filter subroutine is called with two arguments, the first is the filter object and the second is the mail or folder object being filtered. .PP The result from each filter sub is passed to the next filter as the mail object. If a filter subroutine returns undef, then \f(CW\*(C`Mail::Filter\*(C'\fR will abort and return immediately. .PP The function returns the result from the last subroutine to operate on the mail object. .SH METHODS .IX Header "METHODS" .SS Constructors .IX Subsection "Constructors" .IP Mail::Filter\->\fBnew\fR(@filters) 4 .IX Item "Mail::Filter->new(@filters)" Create a new \f(CW\*(C`Mail::Filter\*(C'\fR object with the given filter subroutines. Each filter may be either a code reference or the name of a method to call on the object. .SS Accessors .IX Subsection "Accessors" .ie n .IP $obj\->\fBadd\fR(@filters) 4 .el .IP \f(CW$obj\fR\->\fBadd\fR(@filters) 4 .IX Item "$obj->add(@filters)" Add the given \f(CW@filters\fR to the end of the filter list. .SS Processing .IX Subsection "Processing" .ie n .IP $obj\->\fBfilter\fR($mail|$folder) 4 .el .IP \f(CW$obj\fR\->\fBfilter\fR($mail|$folder) 4 .IX Item "$obj->filter($mail|$folder)" If the first argument is a Mail::Internet object, then this object will be passed through the filter list. If the first argument is a Mail::Folder object, then each message in turn will be passed through the filter list. .ie n .IP $obj\->\fBfolder\fR() 4 .el .IP \f(CW$obj\fR\->\fBfolder\fR() 4 .IX Item "$obj->folder()" While the \fBfilter()\fR method is called with a Mail::Folder object, these filter subroutines can call this method to obtain the folder object that is being processed. .ie n .IP $obj\->\fBmsgnum\fR() 4 .el .IP \f(CW$obj\fR\->\fBmsgnum\fR() 4 .IX Item "$obj->msgnum()" If the \fBfilter()\fR method is called with a Mail::Folder object, then the filter subroutines may call this method to obtain the message number of the message that is being processed. .SH "SEE ALSO" .IX Header "SEE ALSO" This module is part of the MailTools distribution, \&\fIhttp://perl.overmeer.net/mailtools/\fR. .SH AUTHORS .IX Header "AUTHORS" The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. .PP Mail::Cap by Gisle Aas . Mail::Field::AddrList by Peter Orbaek . Mail::Mailer and Mail::Send by Tim Bunce . For other contributors see ChangeLog. .SH LICENSE .IX Header "LICENSE" Copyrights 1995\-2000 Graham Barr and 2001\-2017 Mark Overmeer . .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See \fIhttp://www.perl.com/perl/misc/Artistic.html\fR