in reply to Re: = for lists and hashes?
in thread = for lists and hashes?

I see what you're doing,

I use that method too in a different project, but I'd really like the hashes and friends to be named the same in the Config module and the config file, that way, we don't get confused. There's more than one hash in the config, but if all I had was name => value pairs, this would be the way to go.

Thanks

 

-justin simoni
!skazat!

Replies are listed 'Best First'.
Re: Re: Re: = for lists and hashes?
by rjray (Chaplain) on Mar 21, 2002 at 09:21 UTC
    I use that method too in a different project, but I'd really like the hashes and friends to be named the same in the Config module and the config file, that way, we don't get confused.

    I cannot stress enough the potential danger in this. Besides the obvious fact that someone could break security on the owning UID for that file and insert malicious code, there is another, more dire possible effect: you may have to maintain this code.

    What you are currently doing is very fragile, almost completely unscalable, and quite unreadable to someone looking at the code without the benefit of having been there from the beginning. It is far better to develop a regular habit of using a configuration file that is not itself code. Not only does that make for fewer maintenance headaches, it opens the possibility of sharing config resources between applications, moving parts of the application to more modular designs, and a general sense of ease in the world at large.

    If you are not fond of the idea of writing Yet Another Configuration Parser, I recommend starting with examination of AppConfig, Config::General, ParsePlainConfig and XML::Config. Not surprisingly, given Perl's strong text-manipulation abilities, there has been quite a lot of work done in terms of flexible configuration tools.

    --rjray