Config :: YAML :: Modern - work with .yaml configuration files on steroids
Today a fresh module has been released for working with .yaml configuration files. As usual, it is available to the public on github Config :: YAML :: Modern , a bit later Config :: YAML :: Modern will be added to CPAN .
Why might you be interested in this module? He can do some cool tricks, for example:
Areas of use? Offhand - the project configuration for teamwork!
Interesting? Details under the cut.
So, YAML is the most convenient markup format for configuration files. It is at least human-readable and allows you to make comments (a stone in the direction of json ). It is platform independent ( platform = language used ). He's cool. Use YAML or die!
Persuaded? We move on.
The most convenient form of the project configuration view when working together looks something like WTF !! ?? C'mon, everything is pretty damn clear - there is main_config aka the main configuration of the project and two folders of developers, which contain the diffs from the state of the main system.
The first, meettya, seems to be doing something with another muscle.
The second one, nic, screwed up another pg server and does something with the system for sending messages to clients.
Diff is sexy! At any time, you can understand how your environment differs from the general config.
An example of how to use this beauty:
All! This is all you need to do to get a hash with the database parameters in $ db_mysql_config, well, what you usually write there.
The above example is the simplest, the module has a few more tasty buns in stock, which I clumsily tried to cover in the documentation.
Use with pleasure and health!
PS. Comments, wishes - send in patches on github! :)
Why might you be interested in this module? He can do some cool tricks, for example:
- correctly stomp a pack of .yaml files from the directory
- convert file.name.yaml file name to {File => {Name => {_content here_}}
- provides a plague dive-style path-resolution qw / File Name inner_hash 0 my_key /
Areas of use? Offhand - the project configuration for teamwork!
Interesting? Details under the cut.
So, YAML is the most convenient markup format for configuration files. It is at least human-readable and allows you to make comments (a stone in the direction of json ). It is platform independent ( platform = language used ). He's cool. Use YAML or die!
Persuaded? We move on.
The most convenient form of the project configuration view when working together looks something like WTF !! ?? C'mon, everything is pretty damn clear - there is main_config aka the main configuration of the project and two folders of developers, which contain the diffs from the state of the main system.
The first, meettya, seems to be doing something with another muscle.
The second one, nic, screwed up another pg server and does something with the system for sending messages to clients.
Diff is sexy! At any time, you can understand how your environment differs from the general config.
An example of how to use this beauty:
use Config::YAML::Modern;
my $directory_main = '/etc/main_config/';
# you are set before in bash "export DEVELOP_CONFIG_DIR=/etc/meettya_config/"
my $directory_develop = $ENV{'DEVELOP_CONFIG_DIR'};
my $config = Config::YAML::Modern->new( key_conversion => 'ucfirst' );
$config->dir_load($directory_main);
if ( defined $directory_develop ){
$config->dir_add( $directory_develop, 'RIGHT_PRECEDENT' );
}
my $db_mysql_config = $config->dive(qw/Db Mysql/);
All! This is all you need to do to get a hash with the database parameters in $ db_mysql_config, well, what you usually write there.
The above example is the simplest, the module has a few more tasty buns in stock, which I clumsily tried to cover in the documentation.
Use with pleasure and health!
PS. Comments, wishes - send in patches on github! :)