GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Class::Workflow::Transition::Simple(3) User Contributed Perl Documentation Class::Workflow::Transition::Simple(3)

Class::Workflow::Transition::Simple - A useful class (or base class) for writing transitions.

        use Class::Workflow::Transition::Simple;

        my $t = Class::Workflow::Transition::Simple->new(
                name           => "feed",
                to_state       => $not_hungry, # Class::Workflow::Transition::State
                body_sets_fields => 1,
                body           => sub {
                        my ( $self, $instance, @args ) = @_;

                        my $remain = $global_food_warehouse->reduce_quantity;

                        return (
                                remaining_food => $remain,
                        );
                },
        );

name
This is just a string. It can be used to identify the transition in a parent object like "Class::Workflow" if any.
to_state
This is the state the transition will transfer to. This comes from "Class::Workflow::Transition::Deterministic".
body
This is an optional sub (it defaults to "<sub { }">) which will be called during apply, after all validation has passed.

The body is invoked as a method on the transition.

See "body_sets_fields" for the semantics of the return value.

body_sets_fields
When true, then the body is expected to return a hash of fields to override in the instance. See Class::Workflow::Transition::Deterministic for details.

This field is present to avoid writing code like this:

        return ( {}, @return_values );
    

When you don't want to set fields in the instance.

Defaults to false (just write return @return_value, set to true to set fields).

See also "set_fields".

set_fields
This field is a hash ref that will be used as the list of fields to set on the instance when "body_sets_fields" is false.

If your transition does not need to dynamically set fields you should probably use this.

Defaults to "{}".

validate
validators
clear_validators
add_validators
These methods come from Class::Workflow::Transition::Validate::Simple.

This class consumes the following roles:
  • Class::Workflow::Transition::Deterministic
  • Class::Workflow::Transition::Strict
  • Class::Workflow::Transition::Validate::Simple
2009-01-10 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.