Text::CSV::Unicode(3pm)

Text::CSV::Unicode3pm

Comma-separated values manipulation routines with potentially wide character data

Usage

    use Text::CSV::Unicode;
    $csv = Text::CSV::Unicode->new();
    # then use methods from Text::CSV
    $version = Text::CSV::Unicode->VERSION();   # get the module version
    $csv = Text::CSV::Unicode->new();   # create a new object
    $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

Overview

Text::CSV::Unicode provides facilities for the composition and decomposition of comma-separated values, based on Text::CSV. Text::CSV::Unicode allows for input with wide character data but does not permit control characters.

Incompatible Changes

Option always_quote=>1 (v0.300)

Before v0.300, the module behaviour defaulted to "always_quote => 1" in Text::CSV. This behaviour was only needed in tests.

To recreate the old behaviour:

    $csv = Text::CSV::Unicode->new( { always_quote => 1 } );

Deprecated

The option "binary => 1" does not require this module.

This code issues a 'deprecated' warning and creates a Text::CSV object:

    $csv = Text::CSV::Unicode->new( { binary => 1 } );

Methods

VERSION

This function may be called as a class or an object method. As a class method, it returns the currrent module version. As an object method, it returns the version of the underlying Text::CSV module.

version

An object method: it returns the backend module version.

new
    $csv = Text::CSV::Unicode->new( [{ binary => 1 }] );

This function may be called as a class method. It returns a reference to a newly created object.

"binary => 0" allows the same ASCII input as Text::CSV.

"binary => 1" allows for all Unicode characters in the input (including \r and \n): the same functionality as "Text::CSV->new( { binary => 1 }".

combine
    $status = $csv->combine(@columns);

This object function constructs a CSV string from the arguments, returning success or failure. Failure can result from lack of arguments or an argument containing an invalid character.

Silently accepts undef values in input and treats as an empty string.

parse
    $status = $csv->parse($line);

This object function decomposes a CSV string into fields, returning success or failure. Failure can result from a lack of argument or the given CSV string is improperly formatted. Upon failure, the value returned by "fields()" is undefined and "error_input()" can be called to retrieve the invalid argument.

Diagnostics

None

Configuration and environment

See HASH option to "->new".

Dependencies

perl 5.8.0

Text::CSV 1.0

Version

0.400

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

Author

Robin Barker <[email protected]>

From libtext-csv-unicode-perl 0.400-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.