Alex Rivera | Logout

How do you manage configuration files in Perl?

Asked 2009-04-14T10:07:25.333
18

I have a program that has to read a configuration file from a PHP script, and a quick search has revealed there are dozens of ways to handle configuration files in Perl:

Brian provides an overview here.

Config::Simple will work for me, since the existing file is INI-like. I am interested to know what style people regularly use in their code though?

Edit
Report

2 Answers

6

One solution is to use Config::Any and let the user choose from many options. Personally, I prefer Config::General.

answered 2009-04-14T11:39:20.837
2

If the audience is technical (used to formatted data structures), then I like using JSON for configuration. In your program it'll work like if you used YAML, but to me it's easier to read (and we use lots of JSON anyway).

If you use JSON::XS there's a "relaxed" option that'll allow comments and trailing commas and such in the files.

answered 2009-04-15T05:57:25.003

Your Answer