Decision-ParseTree

 view release on metacpan or  search on metacpan

lib/Decision/ParseTree.pm  view on Meta::CPAN

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
=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

200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
ParseTree 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 )