Mail::Abuse::Report - Process an abuse report
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, );
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:
Mail::Abuse::Report
-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 to undef.
-reader
undef
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 to undef.
Mail::Abuse::Reader
-filters
A reference to a list of objects that can filter incidents. Normally, objects based on Mail::Abuse::Filter. Defaults to no filters.
Mail::Abuse::Filter
-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.
Mail::Abuse::Incident
-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.
Mail::Abuse::Processor
-debug
A true value causes diagnostic messages to be sent via warn().
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.
->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.
->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.
->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.
->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.
->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.
warn
None by default.
Original version; created by h2xs 1.2 with options
-ACOXcfkn Mail::Abuse -v 0.01
This code is distributed under the same terms as Perl itself, providing the exact same 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.
Luis E. Muñoz <luismunoz@cpan.org>
perl(1).
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Muñoz'. Assuming CP1252
To install Mail::Abuse, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Abuse
CPAN shell
perl -MCPAN -e shell install Mail::Abuse
For more information on module installation, please visit the detailed CPAN module installation guide.