NAME
Machine::State::State - State Machine State Class
VERSION
version 0.05
SYNOPSIS
use Machine::State::State;
my $state = Machine::State::State->new(
name => 'sleep',
next => 'resume'
);
DESCRIPTION
Machine::State::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(Machine::State::Transition->new(...));
$state->add_transition(name => Machine::State::Transition->new(...));
The add_transition method registers a new transition in the transitions collection. The method requires a Machine::State::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.