
This table is a Decision::Table with a different constructor.
It takes scalars instead of objects.
Decision::Table::Condition are constructed with the text attribute filled with the scalar.
Same as the actions initialized with c<Decision::Table::Action> objects.
my $dt = Decision::Table::Compact->new(
conditions =>
[
'drove too fast ?',
'comsumed alcohol ?',
'Police is making controls ?',
],
actions =>
[
'charged admonishment', # 0
'drivers license cancellation', # 1
'nothing happened', # 2
],
# @conditions => @actions
rules =>
[
[ 1, 0, 1 ] => [ 0 ],
[ 1, 1, 1 ] => [ 0, 1 ],
[ 0, 0, 0 ] => [ 2 ],
],
);
Note: $dt->conditions property (and actions) will handle $objects as normal. Only the constructor is different.
Returns a complete table of the condition status. The format is
$condition_id => action_result
where the action result is often true || false.
{
'0' => true,
'1' => false,
'2' => true
};
Note that you just need to reverse the hash to know if one of the tests failed.