NAME

List::Filter::Storage::YAML - plugin for filter storage via YAML files

SYNOPSIS

# This is a plugin, not intended for direct use.
# See: List:Filter:Storage

use List::Filter::Storage::YAML;
my $storage = List::Filter::Storage::YAML->new( {
                                  connect_to  => $yaml_file,
                                } );

 my $filter = List::Filter->new(
  { name         => 'some_search_filter',
      # [... see List::Filter ...]
  } );

$storage->save( $filter )

my $named_filter = $storage->lookup( $name );

DESCRIPTION

List::Filter::Storage::YAML is the plugin that handles storage of List::Filter "filters" (e.g. "filters", "transforms") to YAML files.

METHODS

new

Instantiates a new List::Filter::Profile object.

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.

init

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).

main methods

lookup

Given a filter name, returns a matching filter object, or undef.

save

Given a filter, adds it to the internal mass of "filter_data", and saves the entire set to a yaml file.

Excludes any filters that are named with a leading underscore.

Returns a reference to the given filter object.

internal routines

slurp_yaml_filter_data

This method actually reads the yaml file, and stores the hash of hashes structure inside of the object in "filter_data".

list_filters

Returns a list of all avaliable named filters.

special accessors (access the "extra" namespace)

filter_data

Getter for object attribute filter_data

Note: the yaml file is not slurped in until an attempt is made to access this data.

set_filter_data

Setter for object attribute set_filter_data

basic accessors (defined in List::Filter::Storage);

connect_to

Getter for object attribute connect_to

set_connect_to

Setter for object attribute set_connect_to

owner

Getter for object attribute owner

set_owner

Setter for object attribute set_owner

password

Getter for object attribute password

set_password

Setter for object attribute set_password

attributes

Getter for object attribute attributes

set_attributes

Setter for object attribute set_attributes

extra

Getter for object attribute extra

set_extra

Setter for object attribute set_extra

INTERNALS

Outside of this module, a "filter" is an object, inside of this module, it's a hashref with four fields: "method", "description", "terms", "modifiers". Note, that the "name" is excluded from this list, because each of these hashrefs is stored inside a larger hashref, keyed by "name" for rapid lookups.

The external YAML file contains a copy of this data structure, and it is read and written in it's entirety, and held cached in memory inside this object.

NOTES

SEE ALSO

List::Filter::Project List:Filter:Storage List::Filter

AUTHOR

Joseph Brenner, <doom@kzsu.stanford.edu>, 18 May 2007

COPYRIGHT AND LICENSE

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.

BUGS

None reported... yet.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 51:

'=item' outside of any '=over'

Around line 88:

You forgot a '=back' before '=head2'