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


List-Filter documentation  | view source Contained in the List-Filter distribution.

Index


NAME

Top

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

SYNOPSIS

Top

   # 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

Top

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

METHODS

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.

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

Top

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

Top

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

AUTHOR

Top

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

COPYRIGHT AND LICENSE

Top

BUGS

Top

None reported... yet.


List-Filter documentation  | view source Contained in the List-Filter distribution.