http://qs321.pair.com?node_id=1191478


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