1Workflow::Context(3)  User Contributed Perl Documentation Workflow::Context(3)
2
3
4

NAME

6       Workflow::Context - Data blackboard for Workflows, Actions, Conditions
7       and Validators
8

VERSION

10       This documentation describes version 1.61 of this package
11

SYNOPSIS

13        # Create your own context and merge it with one that may already be
14        # in a workflow
15
16        my $context = Workflow::Context->new();
17        $context->param( foo => 'bar' );
18        $context->param( current_user => User->fetch( 'foo@bar.com' ) );
19        my $wf = FACTORY()->create_workflow( 'w/f', $context );
20
21        # The above is the same as:
22        $context = Workflow::Context->new(
23             foo   => 'bar',
24             current_user => User->fetch( 'foo@bar.com' ),
25        );
26        $wf = FACTORY()->create_workflow( 'w/f', $context );
27
28
29        # In a Condition get the 'current_user' back out of the workflow's context
30
31        sub evaluate {
32            my ( $self, $wf ) = @_;
33            my $current_user = $wf->context->param( 'current_user' );
34            ...
35        }
36
37        # Set values directly into a workflow's context
38
39        $wf->context->param( foo => 'bar' );
40        $wf->context->param( news => My::News->fetch_where( 'date = ?', DateTime->now ) );
41

DESCRIPTION

43       Holds information to pass between your application and a Workflow,
44       including its Actions, Conditions and Validators.
45

OBJECT METHODS

47   init( %params )
48       Adds %params to the context at instantiation.
49
50   merge( $other_context )
51       Merges the values from $other_context into this object. If there are
52       duplicate keys in this object and $other_context, $other_context wins.
53

SEE ALSO

55       •   Workflow
56
58       Copyright (c) 2003-2022 Chris Winters. All rights reserved.
59
60       This library is free software; you can redistribute it and/or modify it
61       under the same terms as Perl itself.
62
63       Please see the LICENSE
64

AUTHORS

66       Please see Workflow
67
68
69
70perl v5.36.0                      2023-01-20              Workflow::Context(3)
Impressum