28 Aug 2009 15:03:01 UTC
- Distribution: Class-Workflow
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (634 / 14 / 1)
- KwaliteeBus factor: 3
- % Coverage
- License: unknown
- Activity24 month
- Download (31.08KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionNUFFIN יובל קוג'מן (Yuval Kogman)
Class::Workflow::Instance - An instance in a workflow, with state and history.
package MyInstance; use Moose; with qw(Class::Workflow::Instance); my $instance = MyInstance->new( state => $initial_state ); my $new_instance = $transition->apply( $instance, @args ); # $instance is in $initial state, no transitions applied # $new_instance may be in another state, $transition has been applied # $new_instance->prev == $instance
A workflow instance encapsulates the current state and workflow history on behalf of some parent object that needs state management.
In Class::Workflow these instances are functionally pure, that is they don't change but instead derive their parent copies, and the reference from a given item is to the most recently derived copy.
This eases auditing, reverting, and the writing of transitions.
The state this instance is in. Required.
The Class::Workflow::Instance object this object was derived from. Optional.
The transition that created this instance from
- derive %fields
Clones the object, setting
prevto the current object, and shadowing the fields with new values from the key value pair list in the arguments.
- clone %fields
The low level clone operation. If you need to override Moose based cloning, because your instance objects are e.g. DBIx::Class objects (see the examples directory), then you would likely want to override this.
See MooseX::Clone for more details.
Module Install Instructions
To install Class::Workflow, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Class::Workflow
For more information on module installation, please visit the detailed CPAN module installation guide.