From: Nick C. <ni...@cl...> - 2003-02-18 15:54:07
|
On Tue, Feb 18, 2003 at 01:07:27PM +0000, Simon Wilcox wrote: > > > > 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. Me too. Splitting a string into a list of values has nothing to do with the fact that the string came from a file. IMO we should be looking to end up somewhere like: CGI::NMS::Config Defines the get(), is_true() and get_list() methods. Provides default implementations for is_true() and get_list(), implemented in terms of get(). CGI::NMS::Config::File Inherits from CGI::NMS::Config Implements new() to read in and parse the file, and get() to fetch a value. -- Nick |