Claes Jakobsson > VS-RuleEngine > VS::RuleEngine::Rule::InputOverThreshold

Download:
VS-RuleEngine-0.09.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

VS::RuleEngine::Rule::InputOverThreshold - Generic rule for checking input thresholds

SYNOPSIS ^

  use VS::RuleEngine::Declare;
  
  my $engine = engine {
      rule 'valid_name' => instanceof "VS::RuleEngine::Rule::InputOverThreshold" => with_args {
          'input_1' => 5,
          'input_2' => -5,
      }
  }

DESCRIPTION ^

This is a generic rule that checks if the value from an input is equal or passes a threshold relative to 0. This can be used to model change matrices where a row represets a rule.

The following table shows the conditions when it matches

  Input | Threshold | Result
  ------+-----------+-------
  x     | 0         | match
  >= y  | y > 0     | match
  >= y  | y < 0     | no match
  <= y  | y < 0     | match
  <= y  | y > 0     | no match

USAGE ^

Rule arguments

This rule expects a hash reference as its argument, which is what with_args provides, where the key is the name of an input and the value is the expected threshold value.

syntax highlighting: