ETLp::File::Config - Parse the file confgiuration defintions


    use ETLp::File::Config;

    my $file_conf = ETLp::File::Config->new(
        directory => "$Bin/../conf",
        definition => 'file_def.cfg',
    # Get the fields from the config file:
    my @fields = @{$file_conf->fields};

ETLp::File::Config parses data file definitions. Defintions are specified in files and consist of the following components separated by whitespace:

    * field name - the name of the field
    * nullable - whether the field is allows nulls (Y or N)
    * validation rules:
        o A regex pattern, specified as qr/<regex>/
        o Varchar(n). String up to n characters.
        o Integer. A positive or negative integer.
        o Real. A real number.
        o Date(<POSIX PATTERN>). A valid date with the format specified
          as a POSIX pattern
        o range(n, m). A numeric range from n to m. If n is not specified
          there is no lower limit. If m is not specified, there is no
          upper limit

Multiple validation rules can be specified per field - simply separate with a semi-colon.

Example Configuration entries

    custname   N    varchar(20)
    cost       Y    integer
    phone      Y    qr/^\d{3}-\d{4}$/
    city       N    qr/^(Auckland|Wellington)$/
    rec_date   N    date(%Y-%n-%d %H:%M%S)   
    period     N    range(1,50); integer

Individual rules can be enclosed in double-quotes, which will be required if any indvidual rule contains a semi-colon:

    contrived_field N "qr/\d;\s{3}/"

Comments can be specified with a hash

    # This is a line comment
    custname   N    varchar(20) # And this is a field comment



Create a Config object.


Hash or hashref consisting of

    * directory: Optional. The directory where the
      file_defintion file can be found.
    * definition: Required. A file that contains a defintion
      of a file. 


    * a ETLp::File::Validate object


Copyright 2010 Redbone Systems Ltd

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

The terms are in the LICENSE file that accompanies this application