file: $CPAN/authors/id/H/HM/HMBRAND/Text-CSV_XS-0.42.tgz
size: 86136 bytes
md5: 1cf4491f48965793f1e31fc74159f20f
We can do MAGIC now!
Dumping the content of a database ($dbh) table ($tbl) to CSV:
my $csv = Text::CSV_XS->new ({ binary => 1, eol => $/ });
open my $fh, ">", "$tbl.csv" or die "$tbl.csv: $!";
my $sth = $dbh->prepare ("select * from $tbl");
$sth->execute;
$csv->print ($fh, $sth->{NAME_lc});
while (my $row = $sth->fetch) {
$csv->print ($fh, $row);
}
close $fh;
2008-04-16 0.42 - H.Merijn Brand
* Generate META.yml myself. I won't use Build.PL
* Array-refs now accept scalars with magic:
$csv->print (*STDOUT, $sth->{NAME_lc});
* More/better examples
* Added t/76_magic.t
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.
|