View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Jakob Voß > Config-Any-CSV-0.02 > Config::Any::CSV



Annotate this POD


View/Report Bugs
Module Version: 0.02   Source   Latest Release: Config-Any-CSV-0.05


Config::Any::CSV - Load CSV as config files


version 0.02


    use Config::Any;
    my $config = Config::Any->load_files({files => \@files});

I recommend to use Config::ZOMG:

    use Config::ZOMG;

    # just load a single file
    my $config_hash = Config::ZOMG->open( $csv_file );

    # load foo.csv (and possible foo_local.csv)
    my $config = Config::ZOMG->new( 
        path => '/path/to/config'
        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. By default, Config::Any::CSV enables the options binary and allow_whitespace. One can modify options with driver_args (Config::Any) or driver (Config::ZOMG). 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

    alice, 42,
    bob, 23,

Is parsed into this Perl structure:

        alice => {
            age  => '42',
            mail => '',
         bob => {
            age => '23',
            mail => ''

The name of the first field is irrelevant and 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.

This module requires Perl 5.10 but it could easily be modified to also run in more ancient versions of Perl.


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.

syntax highlighting: