Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Iteration condition...

by CountZero (Bishop)
on Mar 31, 2008 at 16:48 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://677585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found