r18738 - in /trunk/libtext-csv-perl: CSV_XS.pm CSV_XS.xs ChangeLog MANIFEST META.yml Makefile.PL debian/changelog t/76_magic.t
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Thu Apr 17 20:23:33 UTC 2008
Author: gregoa-guest
Date: Thu Apr 17 20:23:32 2008
New Revision: 18738
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=18738
Log:
New upstream release.
Added:
trunk/libtext-csv-perl/t/76_magic.t
- copied unchanged from r18737, branches/upstream/libtext-csv-perl/current/t/76_magic.t
Modified:
trunk/libtext-csv-perl/CSV_XS.pm
trunk/libtext-csv-perl/CSV_XS.xs
trunk/libtext-csv-perl/ChangeLog
trunk/libtext-csv-perl/MANIFEST
trunk/libtext-csv-perl/META.yml
trunk/libtext-csv-perl/Makefile.PL
trunk/libtext-csv-perl/debian/changelog
Modified: trunk/libtext-csv-perl/CSV_XS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/CSV_XS.pm?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/CSV_XS.pm (original)
+++ trunk/libtext-csv-perl/CSV_XS.pm Thu Apr 17 20:23:32 2008
@@ -30,7 +30,7 @@
use Carp;
use vars qw( $VERSION @ISA );
-$VERSION = "0.41";
+$VERSION = "0.42";
@ISA = qw( DynaLoader );
sub PV { 0 }
@@ -1130,8 +1130,6 @@
An example for creating CSV files:
- use Text::CSV_XS;
-
my $csv = Text::CSV_XS->new;
open my $csv_fh, ">", "hello.csv" or die "hello.csv: $!";
@@ -1149,9 +1147,7 @@
}
close $csv_fh;
-An example for parsing CSV lines:
-
- use Text::CSV_XS;
+An example for parsing CSV strings:
my $csv = Text::CSV_XS->new ({ keep_meta_info => 1, binary => 1 });
@@ -1170,6 +1166,27 @@
$csv->error_diag ();
}
+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;
+
+Reading a CSV file line by line:
+
+ my $csv = Text::CSV_XS->new ({ binary => 1 });
+ open my $fh, "<", "file.csv" or die "file.csv: $!";
+ while (my $row = $csv->getline ($fh)) {
+ # do something with @$row
+ }
+ close $fh;
+
=head1 TODO
=over 2
Modified: trunk/libtext-csv-perl/CSV_XS.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/CSV_XS.xs?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/CSV_XS.xs (original)
+++ trunk/libtext-csv-perl/CSV_XS.xs Thu Apr 17 20:23:32 2008
@@ -56,8 +56,9 @@
#define unless(expr) if (!(expr))
-#define _is_arrayref(f) \
- ( f && SvOK (f) && SvROK (f) && SvTYPE (SvRV (f)) == SVt_PVAV )
+#define _is_arrayref(f) ( f && \
+ (SvROK (f) || (SvRMAGICAL (f) && (mg_get (f), 1) && SvROK (f))) && \
+ SvOK (f) && SvTYPE (SvRV (f)) == SVt_PVAV )
#define CSV_XS_SELF \
if (!self || !SvOK (self) || !SvROK (self) || \
@@ -1143,7 +1144,7 @@
CSV_XS_SELF;
unless (_is_arrayref (fields))
- croak ("Expected fields to be an array ref");
+ croak ("Expected fields to be an array ref");
av = (AV*)SvRV (fields);
Modified: trunk/libtext-csv-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/ChangeLog?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/ChangeLog (original)
+++ trunk/libtext-csv-perl/ChangeLog Thu Apr 17 20:23:32 2008
@@ -1,3 +1,11 @@
+2008-04-16 0.42 - H.Merijn Brand <h.m.brand at xs4all.nl>
+
+ * 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
+
2008-04-11 0.41 - H.Merijn Brand <h.m.brand at xs4all.nl>
* error_diag () subclassable
Modified: trunk/libtext-csv-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/MANIFEST?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/MANIFEST (original)
+++ trunk/libtext-csv-perl/MANIFEST Thu Apr 17 20:23:32 2008
@@ -23,6 +23,7 @@
t/65_allow.t Allow bad formats
t/70_rt.t Tests based on RT reports
t/75_hashref.t getline_hr related tests
+t/76_magic.t array_ref from magig
t/80_diag.t Error diagnostics
t/util.pl Extra test utilities
examples/csv2xls Script to onvert CSV files to M$Excel
Modified: trunk/libtext-csv-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/META.yml?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/META.yml (original)
+++ trunk/libtext-csv-perl/META.yml Thu Apr 17 20:23:32 2008
@@ -1,19 +1,28 @@
--- #YAML:1.0
-name: Text-CSV_XS
-version: 0.41
-abstract: Comma-Separated Values manipulation routines
-license: perl
+name: Text-CSV_XS
+version: 0.42
+abstract: Comma-Separated Values manipulation routines
+license: perl
author:
- H.Merijn Brand <h.merijn at xs4all.nl>
-generated_by: ExtUtils::MakeMaker version 6.44
-distribution_type: module
+generated_by: Author
+distribution_type: module
+provides:
+ Text::CSV_XS:
+ file: CSV_XS.pm
+ version: 0.42
requires:
- perl: 5.005
- Config: 0
- DynaLoader: 0
- IO::Handle: 0
- Test::Harness: 0
- Test::More: 0
+ perl: 5.005
+ DynaLoader: 0
+ IO::Handle: 0
+build_requires:
+ perl: 5.005
+ Config: 0
+ Test::Harness: 0
+ Test::More: 0
+ Tie::Scalar: 0
+resources:
+ license: http://dev.perl.org/licenses/
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
Modified: trunk/libtext-csv-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/Makefile.PL?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/Makefile.PL (original)
+++ trunk/libtext-csv-perl/Makefile.PL Thu Apr 17 20:23:32 2008
@@ -60,7 +60,7 @@
' cover',
'',
'fixmeta: distmeta',
- ' $(PERL) -pi -e"/^ Config/ and print qq{ perl: 5.005\n}" */META.yml',
+ ' perl genMETA.pl',
'',
'tgzdist: fixmeta $(DISTVNAME).tar.gz',
' - at mv -f $(DISTVNAME).tar.gz $(DISTVNAME).tgz',
Modified: trunk/libtext-csv-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-perl/debian/changelog?rev=18738&op=diff
==============================================================================
--- trunk/libtext-csv-perl/debian/changelog (original)
+++ trunk/libtext-csv-perl/debian/changelog Thu Apr 17 20:23:32 2008
@@ -1,3 +1,9 @@
+libtext-csv-perl (0.42-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Thu, 17 Apr 2008 22:21:42 +0200
+
libtext-csv-perl (0.41-1) unstable; urgency=low
* New upstream release.
More information about the Pkg-perl-cvs-commits
mailing list