Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Iteration condition...

by CountZero (Bishop)
on Mar 31, 2008 at 16:48 UTC ( #677585=note: print w/ replies, xml ) Need Help??


in reply to Iteration condition...

What you are trying to build is a state machine.

There are some modules available doing exactly that, such as Class::StateMachine or FSA::Rules. Have a look at them, they may very well inspire you.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


Comment on Re: Iteration condition...
Re^2: Iteration condition...
by radiantmatrix (Parson) on Mar 31, 2008 at 17:24 UTC

    You sir, are the middle and two ends of a fine gentleman -- and a scholar to wit. This is by far the best answer I've seen on this thread. I wish I could ++ more than once.

    FWIW to the OP: Desaware offers a pretty decent introduction to state machines. It seems to do a better job explaining them than I ever do, in any case.

    <radiant.matrix>
    Ramblings and references
    The Code that can be seen is not the true Code
    I haven't found a problem yet that can't be solved by a well-placed trebuchet
Re^2: Iteration condition...
by runrig (Abbot) on Mar 31, 2008 at 17:47 UTC
    I don't know, I think a state machine may be overkill for something with only two states ("started" and "finished" from the looks of the OP).
      May be, but as the OP refered to HTML it will not end with two states and then having a look at the code of those modules can do no harm.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-11-24 08:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (137 votes), past polls