Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • You've now got it, and I also give you bind_columns!

    I value feedback, and probably some improvements on the docs, like adding the new stuff to the SYNOPSIS

      file: $CPAN/authors/id/H/HM/HMBRAND/Text-CSV_XS-0.40.tgz
      size: 85057 bytes
       md5: cb8b2af20925b832159f34eed9793666

    2008-04-07  0.40 - H.Merijn Brand   <>

            * Implemented getline_hr () and column_names () RT 34474
              (suggestions accepted from Mark Stosberg)
            * Corrected misspelled variable names in XS
            * Functions are now =head2 type doc entries (Mark Stosberg)
            * Make SetDiag() available to the perl level, so errors can
              be centralized and consistent
            * Integrate the non-XS errors into XS
            * Add t/75_hashref.t
            * Testcase for error 2023 (Michael P Randall)
            * Completely refactored the XS part of parse/getline, which
              is now up to 6% faster. YMMV
            * Completed bind_columns. On straight fetches now up to three
              times as fast as normal fetches (both using getline ())


           The "getline_hr ()" and "column_names ()" methods work together to
           allow you to have rows returned as hashrefs. You must call
           "column_names ()" first to declare your column names.

            $csv&#8722;>column_names (qw( code name price description ));
            $hr = $csv&#8722;>getline_hr ($io);
            print "Price for $hr&#8722;>{name} is $hr&#8722;>{price} EUR\n";

           "getline_hr ()" will croak if called before "column_names ()".


           Set the keys that will be used in the "getline_hr ()" calls. If no keys
           (column names) are passed, it&#8217;ll return the current setting.

           "column_names ()" accepts a list of scalars (the column names) or a
           single array_ref, so you can pass "getline ()"

             $csv&#8722;>column_names ($csv&#8722;>getline ($io));

           "column_names ()" croaks on invalid arguments.


           Takes a list of references to scalars (max 255) to store the fields
           fetched "by getline_hr ()" in. When you don&#8217;t pass enough references to
           store the fetched fields in, "getline ()" will fail. If you pass more
           than there are fields to return, the remaining references are left

             $csv&#8722;>bind_columns (\$code, \$name, \$price, \$description);
             while ($csv&#8722;>getline ()) {
                 print "The price of a $name is \x{20ac} $price\n";
    Enjoy, have FUN! H.Merijn