Decision-ParseTree
view release on metacpan or search on metacpan
lib/Decision/ParseTree.pm view on Meta::CPAN
132133134135136137138139140141142143144145146147148149150151152=item * the key is the method to run in the rules object
=item * the value must be an arrayref or hashref
=back
=item * ARRAYS are a series of rules run in order
=item * HASHES are a series of answers
=item * SCALARS are endpoints
=back
=head2 Why add more parts, why blow everything in to separate objects.
Sometimes you have to make things messy before they can get clean.
Theres a flexibility that comes with breaking things apart in to nice, neat
little chunks. By separating the rule logic in to one place you can make
very complex rules that do not gunk up your code. You pull the order of these
lib/Decision/ParseTree.pm view on Meta::CPAN
200201202203204205206207208209210211212213214215216217218219220ParseTree is the only thing that can get exported, it's also the only thing in
here, so export away.
=head1 FUNCTIONS
=head2 ParseTree($tree, $rules, $obj)
Runs $obj thru $tree, using $rules as the library of rules.
Returns the first endpoint that you run into as the answer.
=cut
#=== FUNCTION ================================================================
# NAME: ParseTree
# PURPOSE: walk a decision tree to get an answer
# PARAMETERS: $tree : Expected to be a big array ref of stuff pulled from YAML
# $rules: an object of rules that holds $tree's nodes
# $obj : The concept is that this $obj is what is passed thru the
# rules. So build your rules as though $obj will be passed
( run in 0.288 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )