NAME
Mail::Abuse::Report - Process an abuse report
SYNOPSIS
use Mail::Abuse::Report;
my $r = new Mail::Abuse::Report
(
-text => \$report_text,
-reader => $reader,
-filters => [ $f1, $f2, ... ],
-parsers => [ $i1, $i2, ... ],
-processors => [ $p1, $p2, ... ],
-debug => 1,
-config => $config_file,
);
DESCRIPTION
This class encapsulates an abuse report and provides methods to automate tasks such as extracting individual incidents from it, filtering the incidents, etc.
Each of the methods are described in detail, below:
->new(%args)
-
Creates a new
Mail::Abuse::Report
object. It accepts the following arguments:-text
-
Specifies the text that will be used to fill the report with. This is incompatible with
-reader
, so choose one and stick to it. Defaults toundef
. -reader
-
Specifies the object (tipically a member of
Mail::Abuse::Reader
) that will be used to fetch the text of the next report. This is incompatible with-text
, so pick one and stick to it. Defaults toundef
. -filters
-
A reference to a list of objects that can filter incidents. Normally, objects based on
Mail::Abuse::Filter
. Defaults to no filters. -parsers
-
A reference to a list of objects that can parse incidents out of the report text. Normally, objects based on
Mail::Abuse::Incident
. Defaults to no parsers. -processors
-
A reference to a list of objects that can process the incidents on the report, normally objects based on the
Mail::Abuse::Processor
class. Defaults to no processors. -debug
-
A true value causes diagnostic messages to be sent via
warn()
. -config
-
Specifies the name of the config file to fetch configuration items from. Can be left unspecified.
->next()
-
When the object has a reader, fetches the next report text, parses it with the incidents and filters the incidents and processes them with the supplied processors.
Returns the report object if succesful or false otherwise.
If no reader has been supplied to the report object, the same text will be analyzed over and over again.
->flush()
-
Discards all non-essential information from the object. It is meant to be called before reusing the object to process a new report.
This method is automatically called by
->next
.
Also, a number of acccessor methods are defined as follows:
->filters
-
When invoked without arguments, returns a reference to the list of filters (
Mail::Abuse::Filter
objects) attached to this abuse report. Calling the accessor with a list of objects will replace whatever was the prior list.The list can be manipulated, affecting the object directly.
->incidents
-
When invoked without arguments, returns a reference to the list of incidents extracted from this report (
Mail::Abuse::Incident
objects). Calling the accessor with a reference to a list of objects will replace whatever was the prior list.The list can be manipulated, affecting the object directly.
->parsers
-
When invoked without arguments, returns a reference to the list of parsers that are used in this report (
Mail::Abuse::Incident
objects). Calling the accessor with a reference to a list of objects will replace whatever was the prior list.The list can be manipulated, affecting the object directly.
->processors
-
When invoked without arguments, returns a reference to the list of processors attached to this report (
Mail::Abuse::Processor
objects). Calling the accessor with a reference to a list of objects will replace whatever was the prior list.The list can be manipulated, affecting the object directly.
->text
-
Accepts a reference to a scalar containing the text of the report.
Returns a reference to the text of the report.
If the text is altered, you should call
->flush()
to avoid insanity. ->reader
-
If passed a reader object, it will replace the one used for initialization. Otherwise, will return the reader object passed to
->new
. ->config
-
Returns a reference to a hash containing the configuration information read-in by this report. It can be replaced by simply supplying a new reference to a configuration hash.
->debug
-
Returns the debug level of the object. When set to true, debug information is issued through
warn
.
EXPORT
None by default.
HISTORY
LICENSE AND WARRANTY
This code is distributed under the same terms as Perl itself, providing the exact same warranty.
LICENSE AND WARRANTY
This code and all accompanying software comes with NO WARRANTY. You use it at your own risk.
This code and all accompanying software can be used freely under the same terms as Perl itself.
LICENSE AND WARRANTY
This code and all accompanying software comes with NO WARRANTY. You use it at your own risk.
This code and all accompanying software can be used freely under the same terms as Perl itself.
AUTHOR
Luis E. Muñoz <luismunoz@cpan.org>
SEE ALSO
perl(1).
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 452:
Non-ASCII character seen before =encoding in 'Muñoz'. Assuming CP1252