Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Are state machines just for parsing?

by diotalevi (Canon)
on Dec 07, 2004 at 22:15 UTC ( #413023=note: print w/ replies, xml ) Need Help??


in reply to Are state machines just for parsing?

They are also used for application state and workflow processes. I don't normally formally create an FSA but I could draw out a diagram if pressed to do so.

As for your problem, couldn't you just serialize your DFA::Simple object's state to storage between web requests? I imagine it would take a bit of custom work because you won't be able to just Storable::freeze() the object - it contains code references. That's easy to work around - just store the name of the function it is supposed to call and when rebuilding your object, reassociate the hard reference. You might also just give DFA::Simple the ability to call functions by name and avoid having code references at all.


Comment on Re: Are state machines just for parsing?
Re^2: Are state machines just for parsing?
by samtregar (Abbot) on Dec 07, 2004 at 22:23 UTC
    As for your problem, couldn't you just serialize your DFA::Simple object's state to storage between web requests?

    That's not the problem. The problem is that DFA::Simple wants to parse text on a filehandle to trigger events. I don't have a text file full of events, I have a user on the other end of an HTTP connection!

    -sam

      I didn't see anything in the referenced code to indicate that it parsed anything. All it does to decide the next state is run a bunch of your test functions to see which one returns true. What your test functions do is up to them.
        You know, I think you're right. I didn't think hard enough about what $_ was in the examples I was looking at.

        Now I guess the only problem is that the code in DFA::Simple is decidedly scary. Maybe by tomorrow I'll have shaken the memory and I can start using the module with a clear conscience.

        Thanks!
        -sam

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://413023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (12)
As of 2015-07-06 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls