Click here to get back home

Tie::Handle::CSV and newlines

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Tie::Handle::CSV and newlines =?ISO-8859-1?Q?Mathias_K=F6rbe 02-01-2007
Posted by =?ISO-8859-1?Q?Mathias_K=F6rbe on February 1, 2007, 1:47 am
Please log in for more thread options


using Text::CSV_XS with the 'binary' option, I can create a CSV file
which contains fields which have newlines.

Excel will read that file just fine.

When trying to read back such a file using Tie::Handle::CSV,
even when specifying the 'binary' option, the
program barfs when it encounters the first line which
contains a field crossing a newline.

Is there any reliable way to be able to create and read
back files CSV files which include fields with newlines?

merci

Posted by Mumia W. (NOSPAM) on February 1, 2007, 4:03 am
Please log in for more thread options


On 02/01/2007 12:47 AM, Mathias Körber wrote:
> using Text::CSV_XS with the 'binary' option, I can create a CSV file
> which contains fields which have newlines.
>
> Excel will read that file just fine.
>
> When trying to read back such a file using Tie::Handle::CSV, even
> when specifying the 'binary' option, the program barfs when it
> encounters the first line which contains a field crossing a newline.
>
> Is there any reliable way to be able to create and read back files
> CSV files which include fields with newlines?
>
> merci

From
http://search.cpan.org/~danboo/Tie-Handle-CSV-0.05/lib/Tie/Handle/CSV.pm :

> csv_parser
>
> Internally, Text::CSV_XS is used to do CSV parsing and construction.
> By default the Text::CSV_XS instance is instantiated with no
> arguments. If other behaviors are desired, you can create your own
> instance and pass it as the value to this option.


--
Windows Vista and your freedom in conflict:
http://www.regdeveloper.co.uk/2006/10/29/microsoft_vista_eula_analysis/


Posted by =?ISO-8859-1?Q?Mathias_K=F6rbe on February 1, 2007, 4:11 am
Please log in for more thread options


Mumia W. (NOSPAM) wrote:
>> csv_parser
>>
>> Internally, Text::CSV_XS is used to do CSV parsing and construction.
>> By default the Text::CSV_XS instance is instantiated with no
>> arguments. If other behaviors are desired, you can create your own
>> instance and pass it as the value to this option.

tried that with the binary option too. no luck.

had to resort to using Text::CSV_XS directly to make it work. Hmm

Similar ThreadsPosted
Tie::Handle::CSV Help... July 23, 2006, 2:00 pm
Archive::Tar and how to handle *.bz2 archives? September 13, 2005, 3:18 pm
help on how to use PERL to do a "postmessage" to a windows handle January 16, 2005, 12:10 pm
XML::Simple doesn't handle shorthand notation?? January 19, 2005, 6:09 am
Handle multiple input date formats? September 11, 2004, 11:56 am
HTML::Mason handle nonexistent directories June 14, 2005, 12:45 pm
Need to handle the NNTP connection timeout in my code February 8, 2007, 4:51 am
How can I make HTTP::Request handle gzipped content? September 3, 2004, 2:11 am
Can't locate object method "blocking" via package "IO::Handle" June 20, 2005, 8:38 am
How to handle input and output of a program executed by System function in perl July 18, 2004, 2:31 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap