Text::CSV_PP(3pm) User Contributed Perl Documentation Text::CSV_PP(3pm)
NAME
Text::CSV_PP - Text::CSV_XS compatible pure-Perl module
SYNOPSIS
use Text::CSV_PP;
$csv = Text::CSV_PP->new(); # create a new object
# If you want to handle non-ascii char.
$csv = Text::CSV_PP->new({binary => 1});
$status = $csv->combine(@columns); # combine columns into a string
$line = $csv->string(); # get the combined string
$status = $csv->parse($line); # parse a CSV string into fields
@columns = $csv->fields(); # get the parsed fields
$status = $csv->status (); # get the most recent status
$bad_argument = $csv->error_input (); # get the most recent bad argument
$diag = $csv->error_diag (); # if an error occured, explains WHY
$status = $csv->print ($io, $colref); # Write an array of fields
# immediately to a file $io
$colref = $csv->getline ($io); # Read a line from file $io,
# parse it and return an array
# ref of fields
$csv->column_names (@names); # Set column names for getline_hr ()
$ref = $csv->getline_hr ($io); # getline (), but returns a hashref
$eof = $csv->eof (); # Indicate if last parse or
# getline () hit End Of File
$csv->types(@t_array); # Set column types
DESCRIPTION
Text::CSV_PP has almost same functions of Text::CSV_XS which provides facilities for the composition and decomposition of comma-separated
values. As its name suggests, Text::CSV_XS is a XS module and Text::CSV_PP is a Puer Perl one.
VERSION
1.29
This module is compatible with Text::CSV_XS 0.80 and later.
Unicode (UTF8)
On parsing (both for "getline ()" and "parse ()"), if the source is marked being UTF8, then parsing that source will mark all fields that
are marked binary will also be marked UTF8.
On combining ("print ()" and "combine ()"), if any of the combining fields was marked UTF8, the resulting string will be marked UTF8.
FUNCTIONS
These methods are almost same as Text::CSV_XS. Most of the documentation was shamelessly copied and replaced from Text::CSV_XS.
See to Text::CSV_XS.
version ()
(Class method) Returns the current backend module version. If you want the module version, you can use the "VERSION" method,
print Text::CSV->VERSION; # This module version
print Text::CSV->version; # The version of the worker module
# same as Text::CSV->backend->version
new (\%attr)
(Class method) Returns a new instance of Text::CSV_XS. The objects attributes are described by the (optional) hash ref "\%attr". Currently
the following attributes are available:
eol An end-of-line string to add to rows. "undef" is replaced with an empty string. The default is "$". Common values for "eol" are "