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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.