Now, I want to make it more complex, allowing for multiple rules and modifiers to be applied to one item. So, what's a good way to do this?my @locations= ( [ source => 'D:\\dev' ], [ docs => 'D:\\My Documents' ], [ source => 'F:\\dev' ], [ docs => 'F:\\Documents' ], [ norule => 'D:\\Program Files\\util'] );
In Tk, a general mechanism is used for passing arguments that begin with a dash, followed by arguments for that particular flag. Some general code pulls that out and deals with it.
Another idea is to have one item per list element, period, and if it had arguments include it in a nested list. E.g.[ qw ( -this -that 5 6 -other /path/etc/foo ) ],
This is easier to process and clear that the 5 and 6 go with the 'that'.[ '-this', [ that => 5, 6 ], '-other', '/path/etc/foo' ],
In the script, each modifier will be implemented via a callback, which takes the extra arguments too, and the callback can modify the job's object state in some way.
Does anyone else have any suggestions on a good way to do this? "good" for both the user configuring the thing, and the implementation.
—John
In reply to Ways of Passing Configuration Parameters by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |