Text::CSV::Easy_XS - Easy (and fast) CSV parsing and building
use Text::CSV::Easy_XS qw(csv_build csv_parse); my @fields = csv_parse($string); my $string = csv_build(@fields);
Text::CSV::Easy_XS is a simple module for parsing and building CSV lines. This module is written in XS, which is much faster than the PurePerl alternative (Text::CSV::Easy_PP). You can use Text::CSV::Easy directly and it will make the best decision on which module to use.
This module conforms to RFC 4180 (http://tools.ietf.org/html/rfc4180) for both parsing and building of CSV strings.
abc,def, ghi => ( 'abc', 'def', ' ghi' )
"abc","def" => ( 'abc', 'def' )
"a,b","a\nb","a""b" => ( 'a,b', "a\nb", 'a"b' )
abc,def\n => ( 'abc', 'def' )
When building a string using csv_build, all non-numeric strings will always be enclosed in quotes.
Takes a list of fields and will generate a csv string. This subroutine will raise an exception if any errors occur.
Parses a CSV string. Returns a list of fields it found. This subroutine will raise an exception if a string could not be properly parsed.
Note: this module is still in an *alpha* state. This has not been tested with threads. Use at your own risk.
Thomas Peters, <email@example.com>
Copyright (C) 2013 by Thomas Peters
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.