Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: DBD::CSV - how to I coax it to read BOM prefixed files?

by Tux (Canon)
on May 29, 2017 at 06:23 UTC ( #1191478=note: print w/replies, xml ) Need Help??


in reply to DBD::CSV - how to I coax it to read BOM prefixed files?

Work in progress, edited on 2017-02-28, not yet on CPAN, not even committed:

use v5.12; use warnings; use autodie qw( :all ); use Data::Peek; use DBI; open my $fh, ">:encoding(utf-8)", "test.csv"; say $fh qq<\x{FEFF}"foo","bar","baz">; say $fh qq<"1","2","3">; say $fh qq<"4","5","6">; close $fh; my $dbh=DBI->connect ("dbi:CSV:", undef, undef, { RaiseError => 1, PrintError => 0, f_ext => ".csv/r", csv_bom => 1, }); my $sth=$dbh->prepare ("select * from test"); $sth->execute (); while (my @a = $sth->fetchrow_array ()) { DDumper \@a; } $sth->finish ();
$ perl test.pl [ 1, 2, 3 ] [ 4, 5, 6 ]

I can commit and push, so you can play. There are no tests yet and no documentation, so that will delay a real release.

update: 2017-05-29 09:00, pushed with new documentation to github, get the tgz here to test. If all works out as you want, I'll make a release


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://1191478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2023-05-30 18:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?