List::Filter::Storage::DBI - filter storage via DBI
# This is a plugin, not intended for direct use.
# See: List:Filter:Storage
my $lfps_dbi = List::Filter::Storage::DBI->new(
type => 'filter',
connect_to => $connect_to,
owner => $owner,
password => $password,
This is a general, database-neutral (or so I hope) storage plugin that should allow for reading and writing List::Filter filters from any database with a DBI driver.
Note that in the event that database-specific code is needed, A specific plugin that inherits from this one can be written: the List::Filter system should find it automatically, if it's named in the standard way (ala DBD::*). E.g. a postgresql driver would be
Takes an optional hashref as an argument, with named fields identical to the names of the object attributes.
With no arguments, the newly created filter will be empty.
Initialize object attributes and then lock them down to prevent accidental creation of new ones.
Note: there is no leading underscore on name "init", though it's arguably an "internal" routine (i.e. not likely to be of use to client code).
Creates the standard storage tables for this object's type.
Takes a block of sql as an argument, which is expected to contain a CREATE TABLE statement. Tries to run the sql, but does not object if the table already exists already. However, this method "croaks" on any other error.
Note: It tries to create the table, and traps the error if it exists already. This is more portable -- to my knowledge -- than trying to get a listing of existing tables.
Initializes database connection.
Saves the given filter object to the database.
Refuses to save filters named with a leading underscore.
Returns the filter on success, otherwise undef.
Returns a list of all avaliable named filters.
Getter for object attribute dbh
When called for the first time, initiates database connection.
Setter for object attribute set_dbh
Getter for object attribute connect_to
Setter for object attribute set_connect_to
Getter for object attribute owner
Setter for object attribute set_owner
Getter for object attribute password
Setter for object attribute set_password
Getter for object attribute attributes
Setter for object attribute set_attributes
Getter for object attribute extra
Setter for object attribute set_extra
This single table schema isn't an efficient use of an RDMS, but the needs here are relatively simple, and this should be fairly portable.
The primary simplification used here is to serialize the array of terms and store it in a single text field.
Data::Dumper has been used for serialization (in preference to Storable) to improve the readability of the database.
List::Filter::Project List:Filter:Storage List::Filter
Joseph Brenner, <email@example.com>, 18 May 2007
Copyright (C) 2007 by Joseph Brenner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
None reported... yet.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
To install List::Filter, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.