perl で設定ファイルの類をさくっと読む

設定ファイルとかのパーザをいちいち作るのも車輪の再発明すぎ、かといって XML とかの世界までいくかぁ? なときに


Perl module for configuration file and command line parsing
GetOpt との合わせ技ができるのでこれが一番いいかな。設定ファイルのセクション分けは smb.conf というかWindows の *.ini 風味になる

AppConfig is a bundle of Perl5 modules for reading configuration files and parsing command line arguments. This is a descendant of, and supersedes the App::Config module. Functionality is extended over the final version of App::Config (1.09) and includes many new features. This module has been developed and in the process, renamed, as part of an effort to unify the various Perl modules for parsing configuration files and command line arguments.


Parse an Apache style httpd.conf configuration file

This module parses the Apache httpd.conf, or any compatible configfile, and provides methods for you to access the values from theconfig file.


Library for editing configuration files

Library to make editing configuration files easier. It provides functions to deal with configuration files in chunks, allowing nice co-existence with users and other programs on the system. It was written specifically for use with DebConf scripts.


Generic configuration module

This module opens a configuration file and parses it's contents for you. The new method requires one parameter which needs to be a filename. The method getall returns a hash which contains all options and it's associated values of your configuration file.

The format of configuration files supported by Config::General is inspired by the well known apache configuration format, in fact, this module is 100% compatible to apache configurations, but you can also just use simple name/value pairs in your configuration files.

In addition to the capabilities of an apache configuration file it supports some enhancements such as here-documents, C-style comments or multi-line options.