NAME
Spreadsheet::Compare::Reader::CSV - CSV File Adapter for Spreadsheet::Compare
DESCRIPTION
This module provides a fetch interface for reading records from CSV files. It uses Text::CSV to do the heavy lifting. This allows the interface to have maximal flexibility.
ATTRIBUTES
If not stated otherwise, read write attributes can be set as options from the config file passed to Spreadsheet::Compare or spreadcomp.
csv
(readonly) The Text::CSV instance.
csv_options
possible values: <hash>
default: { allow_whitespace : 1, binary : 1, decode_utf8 : 0 }
Example:
csv_options:
__clear__: 1
allow_loose_quotes: 1
allow_whitespace: 1
sep: ';'
A reference to a hash with options for calling the Text::CSV constructor. These will be added to the default setting. To clear the default first, set the option __clear__
to a true value.
filehandle
(readonly) The filehandle for "filename".
filename
(readonly) The filename of the used CSV file for this reader. Use "files" for filename specification.
files
possible values: <list of exactly 2 filenames>
default: []
Example:
files:
- ./left_dir/data.csv
- ./right_dir/data.csv
Relative filenames will be interpreted releative to "rootdir"
fix_empty_header
possible values: <bool>
default: 1
If a header entry does not contain at least one non space character replace it with 'unnamed_<n>' with a simple counter <n>;
make_header_unique
possible values: <bool>
default: 0
If there should be duplicate header names, append an counter '_<n>' to make the header name unique.
rootdir
Set by Spreadsheet::Compare during reader initialisation. Same as "rootdir" in Spreadsheet::Compare.
sep_auto
possible values: <list of possible separators>
default: undef
Example:
sep_auto: [ ";", ",", "|", "\t" ]
Set the list of possible separators in header detection. If left undefined the value set by sep or sep_char in "csv_options" will be used. (see "sep_set" in Text::CSV).
skip_after_head
possible values: <integer>
default: 0
Number of lines to skip after reading the header line.
skip_before_head
possible values: <integer>
default: 0
Number of lines to skip at the beginning of the files before reading the header line.
METHODS
Spreadsheet::Compare::Reader::CSV inherits or overwrites all methods from Spreadsheet::Compare::Reader.