in reply to Text::CSV
It's true that Text::CSV does not directly handle multiline fields, but I found it quite easy to get around
My task was to export/import a set of requirements between tools, for which purpose I (amongst others) needed to add a field and sort the input recursively by parent reference (using Sort::Naturally)
and on printing back, I entered data field by field as
My task was to export/import a set of requirements between tools, for which purpose I (amongst others) needed to add a field and sort the input recursively by parent reference (using Sort::Naturally)
On reading, I created multilines as
while ( my $line = $csv->getline($fh) ) { # Manipulation of unsorted fields during import my @multiline = join(';',@{$line}); push @content, @multiline ; } if (not $csv->eof) { $csv->error_diag(); }
and on printing back, I entered data field by field as
with csv object created as $csv = Text::CSV->new({ binary => 1, auto_diag => 1, sep_char => ';' });for my $line (@result) { my @fields = split(/;/,$line); # Manipulation of sorted fields during export print $fh "$_;" foreach @fields; print $fh "\n"; }
I.e. I never bothered to try using the module for writing back data, nor other suggestions as from above :)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Text::CSV
by Anonymous Monk on Aug 20, 2014 at 14:32 UTC | |
by wilmer_t (Novice) on Aug 25, 2014 at 20:23 UTC |
In Section
Module Reviews