After some complaints about the interface of Text::CSV_XS in the chatterbox, I am thinking of adding a new set of methods. The new interface would default to accepting embedded newlines and would provide a number of convenient shortcuts. The old interface would operate exactly as it does now. I'd really appreciate any comments or suggestions you might have. Many thanks to tye,bart, and diotalevi for suggestions.
use Text::CSV_XS; $c = Text::CSV_XS->new; # use default separator, delimiter,escape or $c = Text::CSV_XS->new(%attr); # set your own separators, delimiters,escapes $c->open_file($filename) # open a CSV file $c->open_string($string) # open a CSV string @row = $c->fetchrow_array # fetch one row into an array $row = $c->fetchrow_hashref # fetch one row into a hashref $table = $c->fetchall_arrayref # fetch all rows into an array of arrays $table = $c->fetchall_hashref($key) # fetch all rows into a hashref $c->write_row( @array ) # insert a row from an array of values $c->write_table($filename,$arrayref) # create a CSV file from an arrayref $c->write_table($filename,$hashref) # create a CSV file from a hashref $c = open_file( $filename ); # loop through a file while(my $row = $c->fetchrow_hashref){ if($row->{$column_name} eq $value){ # do something } }

In reply to Text::CSV_XS - proposed new interface by jZed

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.