Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I was working on a program the other day that performed a series of
operations, all of which could be run individually and independently.
Usually, all would be run together in batch mode, but for testing,
it would be useful to be able to run different operations, or stages,
individually.
So the idea was that in the absence of command line switches, all the operations would be performed. Otherwise, no operations would be performed, unless the correponding switch was explicitly stated on the command line. I find the construct has a certain elegance. Naturally, a corresponding solution could be created with Getopt::Long, but I have to admit I have grown fond of Getopt::Mixed because the processing of command line switches happens more or less in your own code. YMMV. It turns out that I now need to add switches in order to govern how certain stages operate, so the concept no longer holds, but I want to leave this idea here, should I ever need to come back to it.
Oops, looking again at this in a new light, I realise that there is vestigial code that no longer serves any purpose. Specifically, the $restricted variable is redundant. An updated version could be written as
In reply to Another take on command line switches by grinder
|
|