Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: The future of Text::CSV_XS - TODO

by Tux (Canon)
on Apr 07, 2008 at 13:05 UTC ( [id://678746]=note: print w/replies, xml ) Need Help??


in reply to The future of Text::CSV_XS - TODO

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 ()) getline_hr 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->column_names (qw( code name price description )); $hr = $csv->getline_hr ($io); print "Price for $hr->{name} is $hr->{price} EUR\n"; "getline_hr ()" will croak if called before "column_names ()". column_names Set the keys that will be used in the "getline_hr ()" calls. If + no keys (column names) are passed, it'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->column_names ($csv->getline ($io)); "column_names ()" croaks on invalid arguments. bind_columns Takes a list of references to scalars (max 255) to store the fi +elds fetched "by getline_hr ()" in. When you don't pass enough refer +ences to store the fetched fields in, "getline ()" will fail. If you pas +s more than there are fields to return, the remaining references are l +eft untouched. $csv->bind_columns (\$code, \$name, \$price, \$description); while ($csv->getline ()) { print "The price of a $name is \x{20ac} $price\n"; }

Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://678746]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-03-29 13:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found