Skip to content
Perl module to provide a csv parser with options specified on the command-line
Perl
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/Text/CSV
t
.gitignore
Changes
Makefile
README.pod
dist.ini
weaver.ini

README.pod

NAME

Text::CSV::Euclid - Provide a csv parser with options specified on the command-line

VERSION

version 0.103510

SYNOPSIS

In your script:

    use Text::CSV::Euclid;
    my $csv = Text::CSV::Euclid->csv;

    # Now do interesting stuff that involves parsing CSV.
    parse_CSV_files_using($csv);

Now, to run your script:

    $ perl your-script.pl --sep-char='|' --quote-char="'" --escape-char"'"

Your script will read CSV files with vertical bars as separators and single quotes as quotation characters, instead of the defaults (which are commas and double quotes).

    $ perl your-script.pl --sep-char='\t' --quote-char="=" --escape-char"="

Your script will read CSV files with tabs characters as separators and equals signs as quotation characters.

All the options to Text::CSV->new should be supported. These are listed in the OPTIONS section.

DESCRIPTION

This module is intended to be used from a script that deals with tabular data in files. Using this module will allow the user of your script to specify all possible options to Text::CSV's constructor by passing command-line arguments to your script.

FUNCTIONS

csv

This function returns the CSV object created according to the command-line arguments that were passed to the script. Note that this object is only created at the time of its first access, and not before. This means that your script may change elements of %ARGV as it wishes before calling csv, and the returned CSV object will use the modified options. In particular, you can change the defaults in your script without using a BEGIN block.

OPTIONS

Options Affecting the Processing of CSV Data

The following command-line arguments all correspond to the arguments to Text::CSV->new:

--quote-char [=] <char>
--escape-char [=] <char>
--sep-char [=] <char>
--eol [=] <eol>
--always-quote
--binary
--keep-meta-info
--allow-loose-quotes
--allow-loose-escapes
--allow-whitespace
--blank-is-undef
--verbatim

DIAGNOSTICS

Error: unable to create csv parser object before options have been parsed.

You tried to use the csv method of this module before the program's command-line options were parsed. Since the options were not parsed, the module could not know what options to use to construct a CSV object for you. This error is probably only possible if you suppress the import method of this module by using it with an empty import list.

Other errors

See Getopt::Euclid and Text::CSV for errors that could possibly be generated by command-lline parsing or CSV object usage, respectively.

DEPENDENCIES

Text::CSV

Provides the CSV object

Getopt::Euclid

Used for command-line parsing

INCOMPATIBILITIES

This module uses Getopt::Euclid, so it may not interact well with other modules from the Getopt:: family.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to rct+perlbug@thompsonclan.org.

SEE ALSO

Getopt::Euclid =item Text::CSV

INSTALLATION

See perlmodinstall for information and options on installing Perl modules.

AUTHOR

Ryan C. Thompson <rct@thompsonclan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by Ryan C. Thompson.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Something went wrong with that request. Please try again.