Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: Are state machines just for parsing?

by samtregar (Abbot)
on Dec 07, 2004 at 22:23 UTC ( #413025=note: print w/ replies, xml ) Need Help??


in reply to Re: Are state machines just for parsing?
in thread Are state machines just for parsing?

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


Comment on Re^2: Are state machines just for parsing?
Re^3: Are state machines just for parsing?
by diotalevi (Canon) on Dec 07, 2004 at 22:50 UTC
    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

        One thing I'll note is that use strict isn't used in DFA::Simple. You may want to give it a treatment of that before actually using it. You'd want to rescind it when it calls your functions so that you can pass in function names instead of hard references.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (17)
As of 2014-09-23 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (232 votes), past polls