Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Workflow CPAN distribution.

Report information
The Basics
Id: 64940
Status: resolved
Priority: 0/
Queue: Workflow

People
Owner: jonasbn [...] cpan.org
Requestors: hs [...] schlittermann.de
Cc: maik.schueller [...] itelligence.de
AdminCc:

Bug Information
Severity: Important
Broken in: 1.34
Fixed in: 1.37



CC: maik.schueller [...] itelligence.de
Subject: workflow context is not persistent [FIX and .t included]
Just duplicating the message I sent via email... We're evaluating it for integration in some larger project. While doing our first steps, I got trapped by a bug or a feature, I'm not sure about it. For my understanding - if there is information saved in the context of a workflow, this information should persist between the different instantiations of this workflow. $wf = FACTORY->create_workflow("FOO"); $wf->context->param(name => "hans"); $id = $wf->id; exit; … now there should name:"hans" be saved in the context. It is. $wf = FACTORY->fetch_workflow("FOO", $id); … now the $wf->context is empty. Two questions arise: 1) Is this the expected behaviour? 2) When exactly gets the current workflow object saved to the persister? On every change? Directly after setting the context it does not seem to appear in the persister file. 3) Depending on the answer for (2): is there a public "save_workflow" method? I've attached my test file for proving that the context gets lost. And I've attached a patch to cure the above problem, IF it is a bug. -- Heiko
Subject: a
Download a
application/octet-stream 1.6k

Message body not shown because it is not plain text.

forgot to append the test case.
Subject: context-persists.t
#! /usr/bin/perl use strict; use warnings; use Test::More tests => 13; use File::Spec::Functions; use if $ENV{DEBUG} => "Smart::Comments"; use File::Temp; # don't leave any traces :) use Log::Log4perl ":easy"; # makes workflow happy use Workflow::Factory qw(FACTORY); FACTORY->add_config( workflow => { type => "FOO", persister => "file", state => [ { name => "INITIAL", action => [{ name => "NEXT", resulting_state => "DONE" }] }, { name => "DONE" }, ] }, persister => [ { name => "file", class => "Workflow::Persister::File", path => File::Temp->newdir } ], action => [{ name => "NEXT", class => "Workflow::Action::Null" }], ); ### DIRECTORY: FACTORY->get_persister("file")->path->{DIRNAME} ### CREATE my $wf0 = FACTORY->create_workflow("FOO"); ok($wf0, "created workflow"); isa_ok($wf0, "Workflow"); my $file = catfile(FACTORY->get_persister("file")->path->{DIRNAME}, $wf0->id . "_workflow") if $wf0; ### PERSISTER file: $file ok(-f $file, "persister file exists"); ### Set context information $wf0->context->param(name => "hans"); ### 0 id: $wf0->id ### 0 state: $wf0->state ### 0 context: $wf0->context is($wf0->state, "INITIAL", "wf in state INITIAL"); is($wf0->context->param("name"), "hans", "wf context found"); ### executing NEXT $wf0->execute_action("NEXT"); ### 0 state: $wf0->state ### 0 context: $wf0->context is($wf0->state, "DONE", "wf in state DONE"); is($wf0->context->param("name"), "hans", "wf context found"); { # check for hans in persister file open(my $x, $file); ok($x, "persister file opened"); local $/ = ""; like(<$x>, qr/hans/, "found context in persister file"); } ### FETCH $id my $wf1 = FACTORY->fetch_workflow("FOO", $wf0->id); ok($wf1, "fetched workflow"); isa_ok($wf1, "Workflow"); ### 1 state: $wf1->state ### 1 context: $wf1->context is($wf1->state, "DONE", "fetched wf in state DONE"); is($wf1->context->param("name"), "hans", "fetched wf context found");
Hello, I have gone through the patch and have applied the changes manually. Thanks for the contribution, it will be part of the forthcoming release 1.36. jonasbn
CC: maik.schueller [...] itelligence.de
Subject: Re: [rt.cpan.org #64940] workflow context is not persistent [FIX and .t included]
Date: Sun, 11 Nov 2012 22:05:11 +0100
To: "Jonas B. Nielsen via RT" <bug-Workflow [...] rt.cpan.org>
From: Heiko Schlittermann <hs [...] schlittermann.de>
Hi Jonas, Jonas B. Nielsen via RT <bug-Workflow@rt.cpan.org> (So 11 Nov 2012 14:49:37 CET): Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=64940 > > > Hello, > > I have gone through the patch and have applied the changes manually. Thanks for the > contribution, it will be part of the forthcoming release 1.36.
Great. Thank you. Best regards from Dresden/Germany Viele Grüße aus Dresden Heiko Schlittermann -- SCHLITTERMANN.de ---------------------------- internet & unix support - Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} - gnupg encrypted messages are welcome --------------- key ID: 7CBF764A - gnupg fingerprint: 9288 F17D BBF9 9625 5ABC 285C 26A9 687E 7CBF 764A - (gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2 7E92 EE4E AC98 48D0 359B)-
Download signature.asc
application/pgp-signature 836b

Message body not shown because it is not plain text.

Release 1.37 contains the patch an it's test. Thanks for the contribution and sorry about the delay jonasbn, current maintainer of Workflow