[clug] perl question

Alex Satrapa grail at goldweb.com.au
Mon Oct 18 00:39:01 GMT 2004


On 18 Oct 2004, at 10:17, Kim Holburn wrote:

> I have a perl script with a config file.  Recently it seemed to me 
> that it would be better to make the config file a perl fragment, (it 
> just does some variable assignments) and use a "do" statement to read 
> it in.

Not the approach that I would suggest. There are packages such as 
Config::IniFiles to handle config files for you.

Making configuration files out of code fragments is just begging for 
problems everywhere from syntax errors through variable stomping to 
system security. Does the person that the script is run as really want 
to allow the people who can edit the config file to remove/corrupt all 
files on the file system that the script-runner has access to? While 
you're at it, turn on Taint checking and see how badly that breaks your 
scripts.

There are XML, Apache-style, Java-style and INI-style configuration 
file modules available in CPAN, most under the namespace "Config".

HTH
HAND
Alex Satrapa

"If knowledge can create problems, it is not through ignorance that we 
can solve them."  --Isaac Asimov



More information about the linux mailing list