Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Config file

by rcseege (Pilgrim)
on Nov 20, 2005 at 15:59 UTC ( [id://510248]=note: print w/replies, xml ) Need Help??


in reply to Config file

I like Config::Properties which is very similar to the java.util.Properties class. It allows for reading/writing of a file with the folowing formats:

# This will get ignored ! This will also get ignored variable1: /somedirectory variable2: /someotherdirectory variable3 = /yetanotherdirectory variable4: This is a longer than usual \ property value

It ignores blank lines and comments, can recognize = or : as a separator, and can deal with multiline properties. It's pretty easy to use, and handles most simple situations well. This would likely be my first choice.

XML is generally not my first choice for config files, but usually the next step once they start to become less simple and my configuration file needs to be able to cope with a complex configuration where a tree might be useful. XML files are easy for a user who is hand-editing to mess up. I'll second GrandFather's recommendation of XML::Simple but only for those cases that I can't address with a simpler solution.

Many of the other configuration file suggestions that I've seen mentioned I might use if I had no control of the configuration file format that I was reading: Unix passwd file formats, Win32 ini files, etc.


Updated: Huh.. Somehow, I missed AppConfig. Nice one, davidrw - I like it. I think between Config::Properties, AppConfig, and XML-Simple those would cover any of my needs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510248]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found