in reply to RFC: Config::File

If I was to write a config file in Perl syntax (which I know is bad, but sometimes I'm too lazy to get out a proper config file parser off CPAN), I would probably just write it and let it access the scalar values directly off the package, such as $My::Config::SOME_VAR. Apply Scalar::Readonly and you have most of the benifits of a read-only config file.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: RFC: Config::File
by flyingmoose (Priest) on Feb 11, 2004 at 13:37 UTC

    Quite a few web apps (TWiki, YABB, etc) have been known to have a "settings.pl" file that they simply use on startup. This does exactly what you mention above. Very simple, and works very very well. Non-perl coders have no trouble keeping the syntax as long as non-pathological data structures (I love pathological data structures!) are used.

    I suppose there is a security risk if permissions on settings.pl are not well known, obviously... but if you have a permissions problem on your web app, executing arbitrary local code is the least of many concerns.