There is no single best practice. Different people have different preferences and practices, including (and not limited to):
- Using plain Perl data structures in a separate "Config" module
- INI-style config files via e.g. Config::IniFiles
- YAML
- XML
- JSON
Here's a couple of other useful nodes where discussion has taken place:
| [reply] |
Hello,
thanks for the reply - I apologise if my question was not clear. I know how to create and manipulate config files in general. What I am after is any good practices of having a distribution with a config file. Is it as simple as creating a .conf and having it in the same directory? Does CPAN installation support this etc
thanks
Spiros
| [reply] |
Oh, in that case you can look at something like Module::Install::Share for handling the installation of non-code files with your distribution.
| [reply] |
You could place the info in the .pm file after the __DATA__ token and read it using <Your::Package::DATA>.
This has the nice side effect of keeping everything together, with the downside that any local updates would be overwritten by a later install.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
| [reply] |