Class::Workflow

Light weight workflow system.
Download

Class::Workflow Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Yuval Kogman
  • Publisher web site:
  • http://search.cpan.org/~nobull/

Class::Workflow Tags


Class::Workflow Description

Light weight workflow system. Class::Workflow is a lightweight workflow system.SYNOPSIS use Class::Workflow; # ***** NOTE ***** # # This is a pretty long and boring example # # you probably want to see some flashy flash videos, so look in SEE ALSO # first ;-) # # **************** # a workflow object assists you in creating state/transition objects # it lets you assign symbolic names to the various objects to ease construction my $wf = Class::Workflow->new; # ( you can still create the state, transition and instance objects manually. ) # create a state, and set the transitions it can perform $wf->state( name => "new", transitions => , ); # set it as the initial state $wf->initial_state("new"); # create a few more states $wf->state( name => "open", transitions => , ); $wf->state( name => "rejected", ); # transitions move instances from state to state # create the transition named "reject" # the state "new" refers to this transition # the state "rejected" is the target state $wf->transition( name => "reject", to_state => "rejected", ); # create a transition named "accept", # this transition takes a value from the context (which contains the current acting user) # the context is used to set the current owner for the bug $wf->transition( name => "accept", to_state => "opened", body => sub { my ( $transition, $instance, $context ) = @_; return ( owner => $context->user, # assign to the use who accepted it ); }, ); # hooks are triggerred whenever a state is entered. They cannot change the instance # this hook calls a hypothetical method on the submitter object $wf->state( "reject" )->add_hook(sub { my ( $state, $instance ) = @_; $instance->submitter->notify("Your item has been rejected"); }); # the rest of the workflow definition is omitted for brevity # finally, use this workflow in the action that handles bug creation sub new_bug { my ( $submitter, %params ) = @_; return $wf->new_instance( submitter => $submitter, %params, ); } Requirements: · Perl


Class::Workflow Related Software