NAME
Mail::Abuse::Processor::ArchiveDBI - Assign a score to an abuse report
SYNOPSIS
use Mail::Abuse::Processor::ArchiveDBI;
use Mail::Abuse::Report;
my $p = new Mail::Abuse::Processor::ArchiveDBI;
my $report = new Mail::Abuse::Report (processors => [ $p ]);
# ... other pieces of code that configure the report ...
DESCRIPTION
This class allows for the storage of index information from a Mail::Abuse::Report
object and the Mail::Abuse::Incident
objects it contains. The storage is done into any backend properly supported by DBI.
This module can only be used once in the pipeline. The DBI handle used is kept in a package-local variable. This is not a problem, usually. The database connection is disconnected upon object destruction.
The following configuration entries control the behavior of this module:
- archive dsn
-
Specifies the DSN to be used to connect to the DBI datasource. See DBI for information about its format for using different backends.
- archive user
-
The username required for connection to the DBI datasource.
- archive password
-
The password required for connection to the DBI datasource.
- archive reports columns
-
Define which data elements from a
Mail::Abuse::Report
object will be stored as the columns of each row in the database. The elements are specified as <column>:<method>, where column is the database column name used to denote said element and method is the accessor in theMail::Abuse::Report
object.Multiple elemnts referring to the same column can be specified, so as to provide alternative means of accessing the data. The methods are accessed as depicted for the option -m for abuso.
Usually, you will want "store_file" (created by Mail::Abuse::Processor::Store) to be used as the primary key, and "score" as additional data, assuming that you use
::Processor::Store
and::Processor::Score
in your local configuration.There are special "pseudo-elements" that can be also used on the right-hand side. Those are:
- archive incident columns
-
Define the data elements from each
Mail::Abuse::Incident
that will be stored in the DBI backend. This follows the same conventions and syntax as archive report columns.The same "pseudo-elements" are supported, however the value of
$num
is the current index of the incident within the abuse report.The typical value for this would include the elements "ip", "time" and "type". The primary key for this table, typically will be "store_file" and "$num".
- archive incidents foreign key
-
Since there is a one-to-many relationship between the report table and the incident table, this configuration directive allows for the specification of the columns that are used as the primary key of the reports table.
Normally, you will want this to be "store_file", which serves as a unique identifier for the report.
- debug archive
-
When set to a true value, debug information will be issued using
warn()
.
The following functions are implemented.
process($report)
-
Takes a
Mail::Abuse::Report
object as an argument and performs the processing action required.
EXPORT
None by default.
HISTORY
$Log: ArchiveDBI.pm,v $ Revision 1.6 2006/03/22 19:15:14 lem Remove extraneous < - Thanks to Landon Steward for pointing this out
Revision 1.5 2006/03/13 23:20:29 lem Make errors simply display warnings but keep processing. In some instances abuse reports can be re-fed into the pipeline. This causes these reports to not stall processing.
Revision 1.4 2006/02/21 16:59:53 lem Added support for $ENV{...} in the column specifications, so that a source/class can be attached to each report.
Revision 1.3 2005/11/14 00:36:34 lem Minor edits (typos, golfing).
Revision 1.2 2005/03/31 19:11:34 lem undef variables properly. Slight change in the 'debug' messages.
Revision 1.1 2005/03/21 20:06:15 lem Initial support for Mail::Abuse::Processor::ArchiveDBI
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 427:
Non-ASCII character seen before =encoding in 'Muñoz'. Assuming UTF-8