in reply to Revision of a Configuration class

My advice is to just use one of the hundreds of config modules on CPAN instead. There are many discussions on perlmonks about which ones are best for what.

To answer your caching question, use variables in the Configuration class. Using IPC::Shareable won't actually save you memory, but loading the data into variables before mod_perl forks (during startup) will save memory. Don't use pnotes, just create an accessor that returns the cached data. Alternatively you could do this as a singleton class (see Class::Singleton).

Replies are listed 'Best First'.
Re: Re: Revision of a Configuration class
by valdez (Monsignor) on Sep 05, 2002 at 21:51 UTC

    Thank you very much perrin for your advices. Though, I'm already using one of the thousands config modules available on CPAN :) I'll surely try what you suggested.

    I was also looking for an advice on passing a default configuration file via ENV variables, but I didn't get an answer :( May be another module on CPAN could do better than Config::General, but I didn't found it: every modules wants a filename as argument to constructors.

    Thanks, Valerio

      The modules expect you to pass a filename, but you can get that filename any way you want to. Have your code read %ENV, grab the filename, and pass it to Config::General.

        Sorry, I will stop using Babelfish to translate my questions :) What you described is exactly what I did.

        Thanks, Valerio