Class::StateMachine allows to define methods that are dispatched depending on an internal state property via the OnState attribute.