Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    List::Filter::Storage 0.04

    Download button

    No screenshots available
    Downloads: 356  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.8/5)
    10 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Joseph Brenner | More programs
    Perl Artistic License / FREE
    April 23rd, 2008, 15:24 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    List::Filter::Storage description

    List::Filter::Storage is a storage handler for filters (e.g. filters).

    List::Filter::Storage is a storage handler for filters (e.g. filters).

    SYNOPSIS

    use List::Filter::Storage;
    $stash_file = "$ENV{HOME}/project_filters.yaml";
    my $filter_storage = List::Filter::Storage->new({
    storage => [ $stash_file ],
    });
    my $filter = List::Filter->new(
    { name => 'skip_boring_stuff',
    terms => ['-.vb$', '-.js$'],
    method => 'skip_boring_stuff',
    description => "Skip the really boring stuff",
    modifiers => "xi",
    } );

    $filter_storage->save( $filter );

    # And later, in some other code...

    my $filter_storage = List::Filter::Storage->new({ storage =>
    [ $stash_file ] });

    my $filter = $filter_storage->lookup( 'skip_boring_stuff' );


    # Filters lookd up from a path of storage locations:
    # (1) yaml file (2) a DBI database connection
    my $yaml_file = "/tmp/filter_storage.yaml";
    my $lfs = List::Filter::Storage->new( {
    storage=> [
    $yaml_file,
    { format => 'DBI',
    connect_to => $connect_to, # e.g. "dbi:Pg:dbname=$dbname"
    owner => $owner,
    password => $password,
    },
    ] } );


    # storage format "MEM" keeps data in memory only
    my $lfs = List::Filter::Storage->new( {
    storage=> [
    [
    { format => 'MEM',
    connect_to => {},
    }
    ] });

    # automatically make copies in the yaml file of any filters used from DBI
    my $filter_storage = List::Filter::Storage->new(
    { save_filters_when_used => $args->{ save_filters_when_used },
    storage => [ $yaml_file,
    { format => 'DBI',
    connect_to => $connect_to,
    owner => $owner,
    password => $password,
    },
    ],

    } );

    # a storage handler can save objects of type 'transform'
    # (a child of filter):
    my $storage_tran = List::Filter::Storage->new(
    { storage => [ $stash_file ],
    type => 'transform',
    } );
    $storage_tran->save( $transform );

    List::Filter::Storage is a "storage handler", it deals with multiple locations of different types of pluggable backing stores to save and retrieve "filters" (and variant types of filters such as 'transforms'). See List::Filter and List::Filter::Transform.

    To review the nature of the items that need to be stored: At the heart of a "filter" is an array reference called 'terms' which contains a list of arbitrary perl data structures. In the case of the simple 'filter" type, this is a list of regular expressions, in the case of 'transform' it's a list of array references, each containing the three parts of a perl substitution (in an unusual order, counting from 1 to 3: s/1/3/2).

    Also, in addition to this list of 'terms', each filter object also has some attached to it some additional fields of data: 'name', 'method', 'modifiers', and 'description'.

    So this might be thought of an ORM system, except that it's much more specialized (or perhaps "even more braindead") than ORMs usually are. Also, while it can use a database as a backing store (via DBI), the default storage system is simply to dump the data to YAML files, which have the advantage of being relatively easy to read and edit.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    storage handler | filters storage | Perl module | filters | storage | handler

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM