NAME Rule::Engine - A Rule Engine SYNOPSIS use Rule::Engine::Filter; use Rule::Engine::Rule; use Rule::Engine::RuleSet; use Rule::Engine::Session; my $sess = Rule::Engine::Session->new; $sess->set_environment('temperature', 65); # Make a ruleset my $rs = Rule::Engine::RuleSet->new( name => 'some-rule', filter => Rule::Engine::Filter->new( condition => sub { # Check something here. Any object that returns true will # be kept. shift->happy ? 1 : 0 } ) ); # Make a rule to add to the set. This rule's condition will be executed # for each object. If it returns a true value then the action will be # executed for each object. my $rule = Rule::Engine::Rule->new( name => 'temperature', action => sub { my ($env, $obj) = @_; $obj->happy(1); }, condition => sub { my ($env, $obj) = @_; return $foo->favorite_temp == $env->get_environment('temperature'); } ); # Add the rule $rs->add_rule($rule); # Add the ruleset to the session $sess->add_ruleset($rs->name, $rs); # Execute the rule, getting back an arrayref of objects that passed the # filter after running through all the rules whose conditions were met my $results = $sess->execute('some-rule', \@list_of_objects); AUTHOR Cory G Watson, "" ACKNOWLEDGEMENTS COPYRIGHT & LICENSE Copyright 2010 Cory G Watson. This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See http://dev.perl.org/licenses/ for more information.