Ok, here goes. Here is some backround, but if you don't need it, skip to the next paragraph. I have been working on a bit of code to save coders from them selves. What i am doing is adding failure notification to a ton of code which otherwise has none. The idea is to wrap then entire process in an
eval {} and then do error reporting based on that. While this is no huge task, i am also working on a restart logic. By this i mean, i am getting command line arguments, and if -restart is specified with a step name, the code is to go to that step. I would normally do this via
goto, or write the code as an array of functions, but there is a snag. All of this code is being made to look outwardly (and somewhat inwardly, to make training Tcl developer easier (says Tcl Library author)) the same as a Tcl library written by a colleage.
And the problem. I want to let developers specify new "step's" in the code using the syntax :
restartStep step_name1 {
## code here
}
restartStep step_name2 {
## code here
}
I also need to list the step names in my usage message. I am currently using a solution, which is, in my opinion, clumsy. I am currently using source filtering to find the step names, make each one a sub-routine in my own sub-name space (which, i guess i could put into Safe for a testing mode), and save aa array of step names in order (for usage and such).
is there a way to get this syntax without Filter ? I have looked at prototypes, but been unable to get this to work. What i really am wanting here is a syntax the same as
sub, but from what i see of the source, there is no real way to do that. am i missing something, or is this correct ? i figured if anyone would have found a way to do this, it would be a fellow Monk out there.
can't sleep clowns will eat me
-- MZSanford