ETLp::File::Validate - Validate file content
use ETLp::File::Validate; my $val = ETLp::File::Validate->new( data_directory => '/data/incoming', file_config_directory => "$Bin/../conf", file_definition => 'file_def.cfg', localize => 1, type => 'csv' ); my $ret = $val->validate('data.txt'); unless($ret) { my @errors = @{$val->get_errors}; foreach my $error (@errors) { print $error->{line_number} .": " . $error->{message}, "\n"; } } ...
Create a validation object.
Parameters
Hash or hashref consisting of
* type: Required. The type of file (csv), fixed width * data_directory: Optional. The directory where the files to be loaded are located. * file_config_directory: Optional. The directory where the file_defintion file can be found. * file_definition: Required. A file that contains a defintion of the validation rules. If the file_config_directory parameter is not set, then this must be the full path to the defintion file
Returns
* a ETLp::File::Validate object
Validate the file
* The name of the file being validated,
* Success flag (0 = fail, success = 1)
Returns a list of error messages
* None
* An arrayref of hashrefs. Each array elemnet is an error. Each hashref contains the error details o line_number: The line number where the error occurred o field_name: The name of the field that failed validated o field_value: The value in the field o message: The error message
Returns the parsed configuration used by the validation
* a ETLp::File::Config 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
To install ETLp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ETLp
CPAN shell
perl -MCPAN -e shell install ETLp
For more information on module installation, please visit the detailed CPAN module installation guide.