|P is for Practical|
Interface design question: graphing state machines.by Ovid (Cardinal)
|on Dec 20, 2004 at 22:48 UTC||Need Help??|
Ovid has asked for the
wisdom of the Perl Monks concerning the following question:
Note: If you're unfamiliar with state machines, this article should give you the necessary background. Also, a variant of this question was cross-posted to the module authors list.
To do this, here's how a state is defined (see the module for a full explanation):
Each rule now takes an optional hash reference. If supplied, the key is the "label" that appears on the line leading from state to state (take a look at the first state on the linked graph and notice the names.)
If you prefer, you can also specify the rules the old way:
The only difference is that there is no label if a graph is generated. In other words, for rules you can use a subref or a hashref. Does that sound confusing? I think it is.
Can anyone suggest a cleaner syntax for the rule labels? Having state machine graphs auto-generated is really cool, but I don't know if it's worth the expense of making things too confusing to use. Because we're struggling with the syntax, we have not yet uploaded the version with GraphViz support.
As a side note, if you would prefer a completely different syntax for the module, we're open to anything that will make it easier to use, even though it's already pretty easy.