Config::Any::CSV - Load CSV files as config files
version 0.01
The interface of Config::Any sucks, so this example uses Config::JFDI:
use Config::JFDI; my $config = Config::JFDI->new( path => '/path/that/includes/foo.csv', # and/or foo_local.csv name => 'foo' );
This small module adds support of CSV files to Config::Any. Files with extension .csv are read with Text::CSV - see that module for documentation of the particular CSV format. Config::Any::CSV enables the option binary and allow_whitespace. The first row of a CSV file is always interpreted as a list of field names and the first field is always interpreted as key field. For instance this CSV file
.csv
binary
allow_whitespace
name,age,mail alice, 42, alice@example.org bob, 23, bob@example.org
Is parsed into this Perl structure:
{ alice => { age => '42', mail => 'alice@example.org' }, bob => { age => '23', mail => 'bob@example.org' } }
The order of rows gets lost. If a file contains multiple rows with the same first field value, only the last of these rows is used. Empty lines are ignored.
Config::JFDI
Jakob Voss
This software is copyright (c) 2013 by Jakob Voss.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Config::Any::CSV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Any::CSV
CPAN shell
perl -MCPAN -e shell install Config::Any::CSV
For more information on module installation, please visit the detailed CPAN module installation guide.