NAME
Data::Tools::CSV -- compact, pure-perl CSV parsing
SYNOPSIS
use Data::Tools::CSV qw( :all ); # import all functions
use Data::Tools::CSV; # the same as :all :)
use Data::Tools::CSV qw( :none ); # do not import anything
# --------------------------------------------------------------------------
my $array_of_arrays = parse_csv( $csv_data_string );
my @single_line = parse_csv_line( $single_csv_line );
while( <$fh> )
{
parse_csv_line( $_ );
...
}
# hash keys names are mapped from the first line of $csv_data (head)
my @array_of_hashes = parse_csv_to_hash_array( $csv_data );
# --------------------------------------------------------------------------
FUNCTIONS
parse_csv( $csv_data_string )
Parses multi-line CSV text
parse_csv_line( $single_csv_line )
Parses single line CSV data.
parse_csv_to_hash_array( $csv_data )
This function uses first line as hash key names to produce array of hashes for the rest of the data.
NOTE: Lines with more data than header will discard extra data.
NOTE: Lines with less data than header will produce keys with undef values.
IMPLEMENTATION DETAILS
Data::Tools::CSV is pure-perl implementation and has compact code. It parses RFC4180 style CSV files:
https://www.ietf.org/rfc/rfc4180.txt
RFC4180 says:
* lines are CRLF delimited, however CR or LF-only are accepted as well.
* whitespace is data, will not be stripped.
* whitespace and delimiters can be quoted with double quotes (").
* quotes in quoted text should be doubled ("") as escaping.
FEEDBACK
Please, report any bugs or missing features as long as they follow RFC4180.
GITHUB REPOSITORY
git@github.com:cade-vs/perl-data-tools.git
git clone git://github.com/cade-vs/perl-data-tools.git
AUTHOR
Vladi Belperchinov-Shabanski "Cade"
<cade@noxrun.com> <cade@bis.bg> <cade@cpan.org>
http://cade.noxrun.com/