John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Ways of Passing Configuration Parameters
by jeffa (Bishop) on Jun 08, 2001 at 04:39 UTC | |
|
Re: Ways of Passing Configuration Parameters
by DrZaius (Monk) on Jun 08, 2001 at 08:37 UTC | |
by John M. Dlugosz (Monsignor) on Jun 08, 2001 at 19:25 UTC | |
by Coyote (Deacon) on Jun 08, 2001 at 19:54 UTC | |
|
Re: Ways of Passing Configuration Parameters
by mirod (Canon) on Jun 08, 2001 at 11:47 UTC | |
|
(tye)Re: Ways of Passing Configuration Parameters
by tye (Sage) on Jun 09, 2001 at 01:58 UTC | |
by John M. Dlugosz (Monsignor) on Jun 09, 2001 at 02:04 UTC | |
by tye (Sage) on Jun 09, 2001 at 02:14 UTC | |
|
Re: Ways of Passing Configuration Parameters
by bikeNomad (Priest) on Jun 08, 2001 at 19:43 UTC |