App::Rssfilter::FromYaml - create App::Rssfilter objects from YAML configuration
version 0.07
{ package Cool::Name; use Role::Tiny::With; with 'App::Rssfilter::FromYaml'; sub new { ... } sub add_group { ... } sub add_feed { ... } sub add_rule { ... } }; my $cool_name = Cool::Name->from_yaml(<<"End_Of_Yaml"); name: some group rules: # add_rule will be called with ... - keyvalue_pair: some value # then ... - this_hashref: of options with_multiple: keys and values feeds: # same as rules above # mix elements as you please - keyword_pair_for_first_feed: and value - keyword_pair_for_second_feed: with different value - feed_option1: more key-value pairs feed_option2: which will be passed as arguments feed_option3: for the third call to add_feed groups: - name: a subgroup - # subgroups can have their own feeds, rules, and subgroups - feeds: - ... - rules: - ... - groups: - ... - name: 'another subgroup', - feeds: - ... - rules: - ... - groups: - ... End_Of_Yaml
This role will extend its receiving class with a "from_yaml" method. It requires that the receiver has add_group, add_feed, and add_rule methods, and accepts a name attribute to its constructor.
add_group
add_feed
add_rule
name
my $receiver_instance = Receiver::Class->from_yaml( $config );
Create a new instance of the receiving class (using the top-level name in $config as its name), then create subgroups and add feeds or rules to it (or its subgroups).
$config
$config may have four keys:
name - name of this group
groups - list of associative arrays for subgroups, same schema as the original config
groups
feeds - list of feeds to fetch
feeds
rules - list of rules to apply
rules
Daniel Holz <dgholz@gmail.com>
This software is copyright (c) 2013 by Daniel Holz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::Rssfilter, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Rssfilter
CPAN shell
perl -MCPAN -e shell install App::Rssfilter
For more information on module installation, please visit the detailed CPAN module installation guide.