NAME

State::Machine::State - State Machine State Class

VERSION

version 0.05

SYNOPSIS

    use State::Machine::State;

    my $state = State::Machine::State->new(
        name => 'sleep',
        next => 'resume'
    );

DESCRIPTION

State::Machine::State represents a state and it's transitions.

ATTRIBUTES

name

    my $name = $state->name;
    $name = $state->name('inspired');

The name of the state. The value can be any scalar value.

next

    my $transition_name = $state->next;
    $transition_name = $state->next('create_art');

The name of the next transition. The value can be any scalar value. This value is used in automating the transition from one state to the next.

transitions

    my $transitions = $state->transitions;

The transitions attribute contains the collection of transitions the state can apply. The add_transition and remove_transition methods should be used to configure state transitions.

METHODS

add_transition

    $trans = $state->add_transition(State::Machine::Transition->new(...));
    $state->add_transition(name => State::Machine::Transition->new(...));

The add_transition method registers a new transition in the transitions collection. The method requires a State::Machine::Transition object.

remove_transition

    $trans = $state->remove_transition('transition_name');

The remove_transition method removes a pre-defined transition from the transitions collection. The method requires a transition name.

AUTHOR

Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Al Newkirk.

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