Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re (tilly) 1: Text::xSV

by tilly (Archbishop)
on Apr 17, 2001 at 19:07 UTC ( #73161=note: print w/replies, xml ) Need Help??

in reply to Re: Text::xSV
in thread Text::xSV

The API for Text::CSV has you hand lines off to the module to parse. This is incompatible with having the module detect that a return is embedded in a field and so another line needs to be fetched to parse the row. I didn't see any easy way to provide anything like a compatible interface to the current one which handled embedded returns. Therefore I felt that it was best to provide the functionality in a new module with a new API.

Note that the API for Text::CSV_XS is able to handle embedded returns, and I should update this to mention that. However the API they chose seemed specific to their implementation, so I didn't try to tie out to it.

Replies are listed 'Best First'.
Re (tilly) 1: Text::xSV
by graff (Chancellor) on Apr 12, 2002 at 18:12 UTC
    Tilly, I'd like to suggest an addition to Text::xSV. It would be useful for the calling program to access the list of field header strings that are found in / bound from the first row of a CSV file; i.e. add a method like "get_header" as follows:
    sub bind_header { my $self = shift; $self->bind_fields($self->get_row()); $self->{field_name} = [ @{$self->{row}} ]; # this is new delete $self->{row}; } # the following method is new: sub get_header { my $self = shift; if ( exists( $self->{field_name} )) { return wantarray ? @{$self->{field_name}} : $self->{field_name +}; } }

    That works for me, but maybe you would want to do it a little differently. Thanks very much for this module, and for your discussions in various threads about CSV data -- you got my vote.

      I intend to retake maintainance of Text::xSV again. I had hoped to have time to make various improvements today, but that doesn't look viable at this point. :-(

      However within a month it should sprout some hopefully nice goodies. :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (1)
As of 2021-09-22 18:28 GMT
Find Nodes?
    Voting Booth?

    No recent polls found