$csv = Text::CSV_XS->new ();
is equivalent to
$csv = Text::CSV_XS->new ({
quote_char => '"',
escape_char => '"',
sep_char => ';,',
eol => '',
always_quote => 0,
binary => 0,
keep_meta_info => 0,
});
For all of the above mentioned flags, there is an accessor +method
available where you can inquire for the current value, or c+hange
the value
my $quote = $csv->quote_char;
$csv'>binary (1);
:
:
meta_info
@flags = $csv->meta_info ();
This object function returns the flags of the input to "com+bine ()"
or the flags of the resultant decomposed fields of "parse (+)",
whichever was called more recently.
For each field, a meta_info field will hold flags that tell
something about the field returned by the "fields ()" metho+d or
passed to the "combine ()" method. The flags are bitwise 'o+r'd like:
0x0001
The field was quoted.
0x0002
The field was binary.
See the "is_*** ()" methods below.
is_quoted
my $quoted = $csv->is_quoted ($column_idx);
Where $column_idx is the (zero-based) index of the column i+n the
last result of "parse ()".
This returns a true value if the data in the indicated colu+mn was
enclused in "quote_char" quotes. This might be important fo+r data
where ",20070108," is to be treated as a numeric value, and+ where
","20070108"," is explicitely marked as character string da+ta.
is_binary
my $binary = $csv->is_binary ($column_idx);
Where $column_idx is the (zero-based) index of the column i+n the
last result of "parse ()".
This returns a true value if the data in the indicated colu+mn
contained any byte in the range [\x00-\x08,\x10-\x1F,\x7F-\+xFF]
An example for parsing CSV lines:
use Text::CSV_XS;
my $csv = Text::CSV_XS->new ({ keep_meta_info => 1, binary =>+ 1 });
my $sample_input_string =
qq{"I said, ""Hi!""",Yes,"",2.34,,"1.09","\x{20ac}",};
if ($csv->parse ($sample_input_string)) {
my @field = $csv->fields;
foreach my $col (0 .. $#field) {
my $quo = $csv->is_quoted ($col) ? $csv->{quote_char}+ : "";
printf "%2d: %s%s%s\n", $col, $quo, $field[$col], $qu+o;
}
}
else {
my $err = $csv->error_input;
print "parse () failed on argument: ", $err, "\n";
}

As this is probably one of the modules that is used in an enourmous range of applications, not breaking things is essential. I think I've well managed to keep the API fully backward compliant, but please report any failure ASAP.

This may sound like a simple plug for a module, but it is just extreme precaution hoping not to break anything and still manage to extend the module to the modern world.

cbu,
Congrats on dusting off an oldie but goodie. I don't have any comments on the latest version you uploaded, but there have been a number of comments, complaints, and suggestions here over the years. You may be interested in searching. Some of the ones that stuck out to me were: