1Workflow::Condition::NeUssteerd(C3o)ntributed Perl DocumWeonrtkaftlioown::Condition::Nested(3)
2
3
4

NAME

6       Workflow::Condition::Nested - Evaluate nested workflow conditions
7

VERSION

9       This documentation describes version 1.51 of this package
10

DESCRIPTION

12       Typically, the workflow conditions are evaluated directly by the
13       framework in Workflow::State when the action is evaluated. This module
14       allows a workflow condition to contain nested conditions that are
15       evaluated directly rather than via separate workflow actions.
16
17       This allows the workflow to be designed to group multiple conditions
18       and perform advanced  operations like an OR comparision of multiple
19       conditions with "greedy" evaluation (as opposed to "lazy" evaluation).
20
21       A usage example might be a case where 3 of 5 possible approvals are
22       needed for an action to be allowed. The "Greedy OR" condition would
23       define the list of conditions to be evaluated. After checking each
24       condition, it would return the total number of successes. The result is
25       then checked against the number needed, returning the boolean value
26       needed by Workflow::State.
27
28       Note: This class is not used directly, but subclassed by your class
29       that implements the "evaluate()" method and calls methods declared
30       here.
31

SYNOPSIS

33       In condition.xml:
34
35           <condition name="cond1" ... />
36           <condition name="cond2" ... />
37           <condition name="cond3" ... />
38           <condition name="cond4" ... />
39           <condition name="cond5" ... />
40
41           <condition name="count_approvals" class="Workflow::Condition::GreedyOR">
42               <param name="condition" value="cond1" />
43               <param name="condition" value="cond2" />
44               <param name="condition" value="cond3" />
45               <param name="condition" value="cond4" />
46               <param name="condition" value="cond5" />
47           </condition>
48
49           <condition name="check_approvals" class="Workflow::Condition::CheckReturn">
50               <param name="condition" value="count_approvals" />
51               <!-- operator "ge" means: greater than or equal to -->
52               <param name="operator"  value="ge" />
53               <param name="argument"  value="$context->{approvals_needed}" />
54           </condition>
55
56       In workflow.xml:
57
58           <state name="CHECK_APPROVALS" autorun="yes">
59               <action name="null_1" resulting_state="APPROVED">
60                   <condition name="check_approvals" />
61               </action>
62               <action name="null_2" resulting_state="REJECTED">
63                   <condition name="!check_approvals" />
64               </action>
65           </state>
66

IMPLEMENTATION DETAILS

68       This wicked hack runs the condition half-outside of the Workflow
69       framework.  If the Workflow internals change, this may break.
70
71   $self->evaluate_condition( $WORKFLOW, $CONDITION_NAME )
72       The child object class that subclasses this object calls this method to
73       evaluate a nested condition.
74
75       If the condition name starts with an '!', the result of the condition
76       is negated. Note that a side-effect of this is that the return value of
77       the nested condition is ignored. Only the negated boolean-ness is
78       preserved.
79
80       This does implement a trick that is not a convention in the underlying
81       Workflow library. By default, workflow conditions throw an error when
82       the condition is false and just return when the condition is true. To
83       allow for counting the true conditions, we also look at the return
84       value here. If a condition returns zero or an undefined value, but did
85       not throw an exception, we consider it to be '1'. Otherwise, we
86       consider it to be the value returned.
87
89       Copyright (c) 2004-2021 Chris Winters. All rights reserved.
90
91       This library is free software; you can redistribute it and/or modify it
92       under the same terms as Perl itself.
93
94       Please see the LICENSE
95

AUTHORS

97       Please see Workflow
98
99
100
101perl v5.32.1                      2021-01-31    Workflow::Condition::Nested(3)
Impressum