From: Simon W. <es...@ou...> - 2003-02-18 13:07:53
|
On Tue, 2003-02-18 at 12:25, Wizard wrote: > > > If you know you're going to be processing a list, it makes sense to > > process the list when you read the config file. Then, if you want to use > > that list in a second place, you don't have to duplicate the code to > > turn a scalar into a list. > > The config module doesn't know what it will be processing, and it doesn't > want to. Down the road, it may be running under NMSBoard, NMSCount, > NMSuperDuper, NMSWhatchamacallit, etc. We don't want to add that level of > specialization to management of one script's configuration variables. Ah yes. Good point. > > If we plan to abstract it, then we really want to make sure that the > > code gets what it expects now, and not do further processing in the main > > code. > > Right now, the interface only requires the following methods: > $scalar = $cfg->get( 'key' ); > $bool = $cfg->is_true( 'key' ); > $bool = $cfg->is_false( 'key' ); > > If it's desired, we could add get_array and/or get_hash to the interface, > but I really don't think that's necessary considering how simple it is to > get a comma separated list into an array. I'm also not sure that it could be > done safely without making the configuration file format more complex for > the user, either. I see. I would like to see a get_array method. I admit that this separation of concerns is a bit of a thing with me. I just don't like to see processing of variables in otherwise unrelated code. It just makes life difficult when you want to change something, remembering all the places where you split the scalar. Doing it in one place would be handy but not, I guess, essential. > > OK, so these will always be scalars. My suggestion still stands but I'll > > wait until I see code to comment further. > > That's fine, it should be up soon. I have to go back to shoveling my 22 > inches of snow now ;-). Coo. Snow. I like snow. But then I don't have 22" of it to shovel :) Enjoy. Simon. |