I propose we had add a simple, standard config() method to
CGI::Application. This method will at least get of
hashref configuration parameters.

Here's why:

1. param() works fine for configuring a few things in an instance
   script. I like to use it to change minor things allow me to use
   an instance script to drive an application in a different way,
   such as providing a new template path.

   Having a config() method provides an important semantic difference:
   It is intended for use for values that come from a config file. 
   (Thus, it won't be necessary for small projects). 
  
2. We have a nice set of Config plugins to choose from, but they don't
   agree on even a basic API. This means that new plugins and extensions
   can't reliably expect cfg() or config() to exist or or work a particular
   way. 

   Applications authors should be encouraged to provide a "root_url" and
   "root_dir" as standard config variable names that other extensions
   can refer to.

The primary reason to have a simple config() method in the core to
provide a basic, standard API that the config plugin authors can
support, along with their own extensions. 

Eventually, this will make the life of end users easier, because other
plugin authors can depend on this API and document it as another way to
configure their plugins. Thus, more config details can easily move back
into config files and out of code. 

Here's the specific API proposal I have in mind:

 =head2 $self->config
 
 Returns a hashref containing application configuration details.
 
 The intended use is to load to read-only configuration details once
 from a config file at start up time.  

 For applications that need little configuration, L<config()> is not
 necessary-- using C<PARAMS> in an instance script should suffice.

 Also, the C<param()> is the appropriate method to use to set a
 configuraiton value at run time.

 Typically C<config()> is overridden by a plugin which eases the process
 the parsing a configuration file. Configuration plugins that provide at
 least this basic API include:

  ...

 Please note that these plugins are free to provide to additional
 functionality beyond this. 

    
    Mark

-- 
http://mark.stosberg.com/ 


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to