Workflow::Context(3)

πŸ“¦
version 2.09 Β· 2 versions
, in fedora 44

πŸ’– Workflow::Context πŸ’–

okay bestie, welcome to Workflow::Context β€” the Data blackboard for Workflows, Actions, Conditions and Validators πŸŽ€ yes it's really called a blackboard, and yes that's iconic of it.

This page lives in the Workflow::Context(3) section of the user-contributed Perl docs, and the package it describes is at version 2.09 ✨ (that's the version this documentation covers, fr fr).


✨ SYNOPSIS ✨

like, here's the whole vibe in code. watch her go:

# Create your own context and merge it with one that may already be
# in a workflow

my $context = Workflow::Context->new();
$context->param( foo => 'bar' );
$context->param( current_user => User->fetch( 'foo@bar.com' ) );
my $wf = FACTORY()->create_workflow( 'w/f', $context );

# The above is the same as:
$context = Workflow::Context->new(
     foo   => 'bar',
     current_user => User->fetch( 'foo@bar.com' ),
);
$wf = FACTORY()->create_workflow( 'w/f', $context );

# In a Condition get the 'current_user' back out of the workflow's context

sub evaluate {
    my ( $self, $wf ) = @_;
    my $current_user = $wf->context->param( 'current_user' );
    ...
}

# Set values directly into a workflow's context

$wf->context->param( foo => 'bar' );
$wf->context->param( news => My::News->fetch_where( 'date = ?', DateTime->now ) );

tl;dr: you build a context, you hand it to a workflow, and everyone downstream can pull stuff back out of it. πŸ’…


🌸 DESCRIPTION 🌸

Workflow::Context holds information to pass between your application and a Workflow β€” and that includes the workflow's Actions, Conditions and Validators too 🫢.

It's giving shared bag of stuff everyone can reach into. main character energy, honestly. πŸ‘‘


πŸ¦‹ OBJECT METHODS πŸ¦‹

init( %params )

Adds %params to the context right at instantiation. so like, when it's born, it already knows things 🍼✨

merge( $other_context )

Merges the values from $other_context into this object.

⚠️ heads up bestie: if there are duplicate keys in this object and in $other_context, then $other_context wins. no cap. the other context is the one eating. 😀

🌈 SEE ALSO 🌈

  • Workflow

Copyright (c) 2003-2021 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Please see the LICENSE


πŸŽ€ AUTHORS πŸŽ€

Please see Workflow


and that's the whole page, bestie β€” slay πŸ’…βœ¨

sign-off szn: this doc came to you via perl v5.42.0, dated 2026-01-17, and it's the Workflow::Context(3) page. obsessed with her. periodt. πŸ’–πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from