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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.