note
salva
Class::StateMachine::Declarative is the result of my experience developing complex state machines, but for my current kind of problems that may be quite specific, I don't know how that could bend to the problems of other people.
<p>I am still not completely happy with it, but it is true that the current iteration is much better than its predecessors.
<p><blockquote><i>Is it possible to use Class::StateMachine in a Role</blockquote></i>
<p>No, because Class::StateMachine is a metaclass, it plays with the method resolution order (mro) to attain the specific state machine method resolution.
<p>When I designed Class::StateMachine I have a hard time figuring how support the state machine while retaining the full perl object oriented semantics (specifically inheritance and multiple inheritance). But then, when I got to use it for practical matters, I discover that inheritance and state machines do not mix well.
<p>Thinks like defining some states in one class, and others in a subclass, or refining them in the subclass is not a great idea.
<p>It is ok to reuse (via inheritance or roles) the code that implements simple actions, but the state machine definition should be a coherent entity.
1035838
1036411