r32232 - in /branches/upstream/libtext-csv-xs-perl/current: CSV_XS.pm CSV_XS.xs ChangeLog META.yml ppport.h t/70_rt.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sat Mar 21 03:53:51 UTC 2009


Author: ryan52-guest
Date: Sat Mar 21 03:53:46 2009
New Revision: 32232

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32232
Log:
[svn-upgrade] Integrating new upstream version, libtext-csv-xs-perl (0.63)

Modified:
    branches/upstream/libtext-csv-xs-perl/current/CSV_XS.pm
    branches/upstream/libtext-csv-xs-perl/current/CSV_XS.xs
    branches/upstream/libtext-csv-xs-perl/current/ChangeLog
    branches/upstream/libtext-csv-xs-perl/current/META.yml
    branches/upstream/libtext-csv-xs-perl/current/ppport.h
    branches/upstream/libtext-csv-xs-perl/current/t/70_rt.t

Modified: branches/upstream/libtext-csv-xs-perl/current/CSV_XS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/CSV_XS.pm?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/CSV_XS.pm (original)
+++ branches/upstream/libtext-csv-xs-perl/current/CSV_XS.pm Sat Mar 21 03:53:46 2009
@@ -30,7 +30,7 @@
 use Carp;
 
 use vars   qw( $VERSION @ISA );
-$VERSION = "0.62";
+$VERSION = "0.63";
 @ISA     = qw( DynaLoader );
 bootstrap Text::CSV_XS $VERSION;
 
@@ -95,8 +95,16 @@
 	$last_new_err = "Unknown attribute '$_'";
 	return;
 	}
+
+    my $self  = {%def_attr, %{$attr}};
+    if ($self->{allow_whitespace} and
+	    (defined $self->{quote_char}  && $self->{quote_char}  =~ m/^[ \t]$/) ||
+	    (defined $self->{escape_char} && $self->{escape_char} =~ m/^[ \t]$/)) {
+	$last_new_err = SetDiag (undef, 1002);
+	return;
+	}
+
     $last_new_err = SetDiag (undef, 0);
-    my $self  = {%def_attr, %{$attr}};
     defined $\ && !exists $attr->{eol} and $self->{eol} = $\;
     bless $self, $class;
     defined $self->{types} and $self->types ($self->{types});
@@ -153,14 +161,24 @@
 sub quote_char
 {
     my $self = shift;
-    @_ and $self->_set_attr_C ("quote_char", shift);
+    if (@_) {
+	my $qc = shift;
+	defined $qc && $qc =~ m/^[ \t]$/ && $self->{allow_whitespace} and
+	    croak ($self->SetDiag (1002));
+	$self->_set_attr_C ("quote_char", $qc);
+	}
     $self->{quote_char};
     } # quote_char
 
 sub escape_char
 {
     my $self = shift;
-    @_ and $self->_set_attr_C ("escape_char", shift);
+    if (@_) {
+	my $ec = shift;
+	defined $ec && $ec =~ m/^[ \t]$/ && $self->{allow_whitespace} and
+	    croak ($self->SetDiag (1002));
+	$self->_set_attr_C ("escape_char", $ec);
+	}
     $self->{escape_char};
     } # escape_char
 
@@ -232,7 +250,14 @@
 sub allow_whitespace
 {
     my $self = shift;
-    @_ and $self->_set_attr_C ("allow_whitespace", shift);
+    if (@_) {
+	my $aw = shift;
+	$aw and
+	  (defined $self->{quote_char}  && $self->{quote_char}  =~ m/^[ \t]$/) ||
+	  (defined $self->{escape_char} && $self->{escape_char} =~ m/^[ \t]$/) and
+	    croak ($self->SetDiag (1002));
+	$self->_set_attr_C ("allow_whitespace", $aw);
+	}
     $self->{allow_whitespace};
     } # allow_whitespace
 
@@ -713,12 +738,16 @@
 =item allow_whitespace
 
 When this option is set to true, whitespace (TAB's and SPACE's)
-surrounding the separation character is removed when parsing. So
-lines like:
+surrounding the separation character is removed when parsing. If
+either TAB or SPACE is one of the three major characters C<sep_char>,
+C<quote_char>, or C<escape_char> it will not be considered whitespace.
+
+So lines like:
 
   1 , "foo" , bar , 3 , zapp
 
 are now correctly parsed, even though it violates the CSV specs.
+
 Note that B<all> whitespace is stripped from start and end of each
 field. That would make is more a I<feature> than a way to be able
 to parse bad CSV lines, as
@@ -1454,6 +1483,11 @@
 The separation character cannot be equal to either the quotation character
 or the escape character, as that will invalidate all parsing rules.
 
+=item 1002 "INI - allow_whitespace with escape_char or quote_char SP or TAB"
+
+Using C<allow_whitespace> when either C<escape_char> or C<quote_char> is
+equal to SPACE or TAB is too ambiguous to allow.
+
 =item 2010 "ECR - QUO char inside quotes followed by CR not part of EOL"
 
 When C<eol> has been set to something specific, other than the default,

Modified: branches/upstream/libtext-csv-xs-perl/current/CSV_XS.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/CSV_XS.xs?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/CSV_XS.xs (original)
+++ branches/upstream/libtext-csv-xs-perl/current/CSV_XS.xs Sat Mar 21 03:53:46 2009
@@ -126,6 +126,7 @@
     /* Generic errors */
     { 1000, "INI - constructor failed"						},
     { 1001, "INI - sep_char is equal to quote_char or escape_char"		},
+    { 1002, "INI - allow_whitespace with escape_char or quote_char SP or TAB"	},
 
     /* Parse errors */
     { 2010, "ECR - QUO char inside quotes followed by CR not part of EOL"	},
@@ -179,6 +180,15 @@
 	LEAVE;						\
 	io_handle_loaded = 1;				\
 	}
+
+#define is_whitespace(ch) \
+    ( (ch) != csv->sep_char    && \
+      (ch) != csv->quote_char  && \
+      (ch) != csv->escape_char && \
+    ( (ch) == CH_SPACE || \
+      (ch) == CH_TAB \
+      ) \
+    )
 
 #define SvDiag(xse)		cx_SvDiag (aTHX_ xse)
 static SV *cx_SvDiag (pTHX_ int xse)
@@ -853,9 +863,8 @@
 
 #if ALLOW_ALLOW
 		    if (csv->allow_whitespace) {
-			while (c2 == CH_SPACE || c2 == CH_TAB) {
+			while (is_whitespace (c2))
 			    c2 = CSV_GET;
-			    }
 			}
 #endif
 
@@ -906,9 +915,8 @@
 
 #if ALLOW_ALLOW
 		if (csv->allow_whitespace) {
-		    while (c2 == CH_SPACE || c2 == CH_TAB) {
+		    while (is_whitespace (c2))
 			c2 = CSV_GET;
-			}
 		    }
 #endif
 
@@ -1026,10 +1034,12 @@
 #endif
 	    if (waitingForField) {
 #if ALLOW_ALLOW
-		if (csv->allow_whitespace && (c == CH_SPACE || c == CH_TAB)) {
+		if (csv->allow_whitespace && is_whitespace (c)) {
 		    do {
 			c = CSV_GET;
-			} while (c == CH_SPACE || c == CH_TAB);
+			} while (is_whitespace (c));
+		    if (c == EOF)
+			break;
 		    goto restart;
 		    }
 #endif

Modified: branches/upstream/libtext-csv-xs-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/ChangeLog?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/ChangeLog (original)
+++ branches/upstream/libtext-csv-xs-perl/current/ChangeLog Sat Mar 21 03:53:46 2009
@@ -1,3 +1,7 @@
+2009-03-20 0.63 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+	* Fixed allow_whitespace with sep_char = TAB (RT#44402)
+
 2009-03-13 0.62 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
 	* Prevent warnings in older perls (without utf8)

Modified: branches/upstream/libtext-csv-xs-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/META.yml?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/META.yml (original)
+++ branches/upstream/libtext-csv-xs-perl/current/META.yml Sat Mar 21 03:53:46 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.1
 name:              Text-CSV_XS
-version:           0.62
+version:           0.63
 abstract:          Comma-Separated Values manipulation routines
 license:           perl
 author:              
@@ -10,7 +10,7 @@
 provides:
     Text::CSV_XS:
         file:      CSV_XS.pm
-        version:   0.62
+        version:   0.63
 requires:     
     perl:          5.005
     DynaLoader:    0
@@ -23,6 +23,7 @@
     Tie::Scalar:   0
 resources:
     license:       http://dev.perl.org/licenses/
+    repository:    http://repo.or.cz/w/Text-CSV_XS.git
 meta-spec:
     version:       1.4
     url:           http://module-build.sourceforge.net/META-spec-v1.4.html

Modified: branches/upstream/libtext-csv-xs-perl/current/ppport.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/ppport.h?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/ppport.h (original)
+++ branches/upstream/libtext-csv-xs-perl/current/ppport.h Sat Mar 21 03:53:46 2009
@@ -4,7 +4,7 @@
 /*
 ----------------------------------------------------------------------
 
-    ppport.h -- Perl/Pollution/Portability Version 3.16
+    ppport.h -- Perl/Pollution/Portability Version 3.17
 
     Automatically created by Devel::PPPort running under perl 5.010000.
 
@@ -21,7 +21,7 @@
 
 =head1 NAME
 
-ppport.h - Perl/Pollution/Portability version 3.16
+ppport.h - Perl/Pollution/Portability version 3.17
 
 =head1 SYNOPSIS
 
@@ -377,7 +377,7 @@
 # Disable broken TRIE-optimization
 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
 
-my $VERSION = 3.16;
+my $VERSION = 3.17;
 
 my %opt = (
   quiet     => 0,
@@ -447,7 +447,7 @@
 AvFILLp|5.004050||p
 AvFILL|||
 CLASS|||n
-CPERLscope|||p
+CPERLscope|5.005000||p
 CX_CURPAD_SAVE|||
 CX_CURPAD_SV|||
 CopFILEAV|5.006000||p
@@ -466,7 +466,7 @@
 CvPADLIST|||
 CvSTASH|||
 CvWEAKOUTSIDE|||
-DEFSV_set|||p
+DEFSV_set|5.011000||p
 DEFSV|5.004050||p
 END_EXTERN_C|5.005000||p
 ENTER|||
@@ -481,7 +481,7 @@
 G_ARRAY|||
 G_DISCARD|||
 G_EVAL|||
-G_METHOD|||p
+G_METHOD|5.006001||p
 G_NOARGS|||
 G_SCALAR|||
 G_VOID||5.004000|
@@ -603,20 +603,20 @@
 PERL_MAGIC_uvar|5.007002||p
 PERL_MAGIC_vec|5.007002||p
 PERL_MAGIC_vstring|5.008001||p
-PERL_PV_ESCAPE_ALL|||p
-PERL_PV_ESCAPE_FIRSTCHAR|||p
-PERL_PV_ESCAPE_NOBACKSLASH|||p
-PERL_PV_ESCAPE_NOCLEAR|||p
-PERL_PV_ESCAPE_QUOTE|||p
-PERL_PV_ESCAPE_RE|||p
-PERL_PV_ESCAPE_UNI_DETECT|||p
-PERL_PV_ESCAPE_UNI|||p
-PERL_PV_PRETTY_DUMP|||p
-PERL_PV_PRETTY_ELLIPSES|||p
-PERL_PV_PRETTY_LTGT|||p
-PERL_PV_PRETTY_NOCLEAR|||p
-PERL_PV_PRETTY_QUOTE|||p
-PERL_PV_PRETTY_REGPROP|||p
+PERL_PV_ESCAPE_ALL|5.009004||p
+PERL_PV_ESCAPE_FIRSTCHAR|5.009004||p
+PERL_PV_ESCAPE_NOBACKSLASH|5.009004||p
+PERL_PV_ESCAPE_NOCLEAR|5.009004||p
+PERL_PV_ESCAPE_QUOTE|5.009004||p
+PERL_PV_ESCAPE_RE|5.009005||p
+PERL_PV_ESCAPE_UNI_DETECT|5.009004||p
+PERL_PV_ESCAPE_UNI|5.009004||p
+PERL_PV_PRETTY_DUMP|5.009004||p
+PERL_PV_PRETTY_ELLIPSES|5.010000||p
+PERL_PV_PRETTY_LTGT|5.009004||p
+PERL_PV_PRETTY_NOCLEAR|5.010000||p
+PERL_PV_PRETTY_QUOTE|5.009004||p
+PERL_PV_PRETTY_REGPROP|5.009004||p
 PERL_QUAD_MAX|5.004000||p
 PERL_QUAD_MIN|5.004000||p
 PERL_REVISION|5.006000||p
@@ -649,8 +649,8 @@
 PL_DBsub|||pn
 PL_DBtrace|||pn
 PL_Sv|5.005000||p
-PL_bufend|||p
-PL_bufptr|||p
+PL_bufend|5.011000||p
+PL_bufptr|5.011000||p
 PL_compiling|5.004050||p
 PL_copline|5.011000||p
 PL_curcop|5.004050||p
@@ -666,14 +666,14 @@
 PL_hints|5.005000||p
 PL_last_in_gv|||n
 PL_laststatval|5.005000||p
-PL_lex_state|||p
-PL_lex_stuff|||p
-PL_linestr|||p
+PL_lex_state|5.011000||p
+PL_lex_stuff|5.011000||p
+PL_linestr|5.011000||p
 PL_modglobal||5.005000|n
 PL_na|5.004050||pn
 PL_no_modify|5.006000||p
-PL_ofs_sv|||n
-PL_parser|||p
+PL_ofsgv|||n
+PL_parser|5.009005||p
 PL_perl_destruct_level|5.004050||p
 PL_perldb|5.004050||p
 PL_ppaddr|5.006000||p
@@ -691,7 +691,7 @@
 PL_sv_yes|5.004050||pn
 PL_tainted|5.004050||p
 PL_tainting|5.004050||p
-PL_tokenbuf|||p
+PL_tokenbuf|5.011000||p
 POP_MULTICALL||5.011000|
 POPi|||n
 POPl|||n
@@ -703,6 +703,7 @@
 PTR2IV|5.006000||p
 PTR2NV|5.006000||p
 PTR2UV|5.006000||p
+PTR2nat|5.009003||p
 PTR2ul|5.007001||p
 PTRV|5.006000||p
 PUSHMARK|||
@@ -850,7 +851,7 @@
 SvPV_nomg_const_nolen|5.009003||p
 SvPV_nomg_const|5.009003||p
 SvPV_nomg|5.007002||p
-SvPV_renew|||p
+SvPV_renew|5.009003||p
 SvPV_set|||
 SvPVbyte_force||5.009002|
 SvPVbyte_nolen||5.006000|
@@ -1032,7 +1033,6 @@
 av_delete||5.006000|
 av_exists||5.006000|
 av_extend|||
-av_fake|||
 av_fetch|||
 av_fill|||
 av_iter_p||5.011000|
@@ -1139,7 +1139,6 @@
 custom_op_desc||5.007003|
 custom_op_name||5.007003|
 cv_ckproto_len|||
-cv_ckproto|||
 cv_clone|||
 cv_const_sv||5.004000|
 cv_dump|||
@@ -1285,7 +1284,6 @@
 expect_number|||
 fbm_compile||5.005000|
 fbm_instr||5.005000|
-fd_on_nosuid_fs|||
 feature_is_enabled|||
 fetch_cop_label||5.011000|
 filter_add|||
@@ -1329,6 +1327,7 @@
 get_debug_opts|||
 get_hash_seed|||
 get_hv|5.006000||p
+get_isa_hash|||
 get_mstats|||
 get_no_modify|||
 get_num|||
@@ -1441,6 +1440,7 @@
 ibcmp|||
 incline|||
 incpush_if_exists|||
+incpush_use_sep|||
 incpush|||
 ingroup|||
 init_argv_symbols|||
@@ -1462,24 +1462,23 @@
 intuit_more|||
 invert|||
 io_close|||
-isALNUMC|||p
+isALNUMC|5.006000||p
 isALNUM|||
 isALPHA|||
-isASCII|||p
-isBLANK|||p
-isCNTRL|||p
+isASCII|5.006000||p
+isBLANK|5.006001||p
+isCNTRL|5.006000||p
 isDIGIT|||
-isGRAPH|||p
+isGRAPH|5.006000||p
 isLOWER|||
-isPRINT|||p
-isPSXSPC|||p
-isPUNCT|||p
+isPRINT|5.004000||p
+isPSXSPC|5.006001||p
+isPUNCT|5.006000||p
 isSPACE|||
 isUPPER|||
-isXDIGIT|||p
+isXDIGIT|5.006000||p
 is_an_int|||
 is_gv_magical_sv|||
-is_gv_magical|||
 is_handle_constructor|||n
 is_list_assignment|||
 is_lvalue_sub||5.007001|
@@ -1617,7 +1616,6 @@
 magic_set|||
 magic_sizepack|||
 magic_wipepack|||
-magicname|||
 make_matcher|||
 make_trie_failtable|||
 make_trie|||
@@ -1630,6 +1628,7 @@
 memEQ|5.004000||p
 memNE|5.004000||p
 mem_collxfrm|||
+mem_log_common|||n
 mess_alloc|||
 mess_nocontext|||vn
 mess||5.006000|v
@@ -1654,13 +1653,17 @@
 more_bodies|||
 more_sv|||
 moreswitches|||
-mro_get_linear_isa_c3|||
+mro_get_from_name||5.011000|
 mro_get_linear_isa_dfs|||
 mro_get_linear_isa||5.009005|
+mro_get_private_data||5.011000|
 mro_isa_changed_in|||
 mro_meta_dup|||
 mro_meta_init|||
 mro_method_changed_in||5.009005|
+mro_register||5.011000|
+mro_set_mro||5.011000|
+mro_set_private_data||5.011000|
 mul128|||
 mulexp10|||n
 my_atof2||5.007002|
@@ -1723,7 +1726,6 @@
 my_swap|||
 my_unexec|||
 my_vsnprintf||5.009004|n
-my|||
 need_utf8|||n
 newANONATTRSUB||5.006000|
 newANONHASH|||
@@ -1819,7 +1821,6 @@
 num_overflow|||n
 offer_nice_chunk|||
 oopsAV|||
-oopsCV|||
 oopsHV|||
 op_clear|||
 op_const_sv|||
@@ -2009,6 +2010,7 @@
 save_I16||5.004000|
 save_I32|||
 save_I8||5.006000|
+save_adelete||5.011000|
 save_aelem||5.004050|
 save_alloc||5.006000|
 save_aptr|||
@@ -2026,7 +2028,9 @@
 save_gp||5.004000|
 save_hash|||
 save_hek_flags|||n
+save_helem_flags||5.011000|
 save_helem||5.004050|
+save_hints|||
 save_hptr|||
 save_int|||
 save_item|||
@@ -2040,6 +2044,10 @@
 save_op|||
 save_padsv_and_mortalize||5.011000|
 save_pptr|||
+save_pushi32ptr|||
+save_pushptri32ptr|||
+save_pushptrptr|||
+save_pushptr||5.011000|
 save_re_context||5.006000|
 save_scalar_at|||
 save_scalar|||
@@ -2082,6 +2090,7 @@
 scan_word|||
 scope|||
 screaminstr||5.005000|
+search_const|||
 seed||5.008001|
 sequence_num|||
 sequence_tail|||
@@ -2091,7 +2100,6 @@
 set_numeric_radix||5.006000|
 set_numeric_standard||5.006000|
 setdefout|||
-setenv_getix|||
 share_hek_flags|||
 share_hek||5.004000|
 si_dup|||
@@ -2286,7 +2294,9 @@
 sv_utf8_decode||5.006000|
 sv_utf8_downgrade||5.006000|
 sv_utf8_encode||5.006000|
+sv_utf8_upgrade_flags_grow||5.011000|
 sv_utf8_upgrade_flags||5.007002|
+sv_utf8_upgrade_nomg||5.007002|
 sv_utf8_upgrade||5.007001|
 sv_uv|5.005000||p
 sv_vcatpvf_mg|5.006000|5.004000|p
@@ -3732,7 +3742,6 @@
 #endif
 
 #ifndef INT2PTR
-
 #  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
 #    define PTRV                  UV
 #    define INT2PTR(any,d)        (any)(d)
@@ -3744,19 +3753,34 @@
 #    endif
 #    define INT2PTR(any,d)        (any)(PTRV)(d)
 #  endif
-
-#  define NUM2PTR(any,d)  (any)(PTRV)(d)
-#  define PTR2IV(p)       INT2PTR(IV,p)
-#  define PTR2UV(p)       INT2PTR(UV,p)
-#  define PTR2NV(p)       NUM2PTR(NV,p)
-
+#endif
+
+#ifndef PTR2ul
 #  if PTRSIZE == LONGSIZE
 #    define PTR2ul(p)     (unsigned long)(p)
 #  else
 #    define PTR2ul(p)     INT2PTR(unsigned long,p)
 #  endif
-
-#endif /* !INT2PTR */
+#endif
+#ifndef PTR2nat
+#  define PTR2nat(p)                     (PTRV)(p)
+#endif
+
+#ifndef NUM2PTR
+#  define NUM2PTR(any,d)                 (any)PTR2nat(d)
+#endif
+
+#ifndef PTR2IV
+#  define PTR2IV(p)                      INT2PTR(IV,p)
+#endif
+
+#ifndef PTR2UV
+#  define PTR2UV(p)                      INT2PTR(UV,p)
+#endif
+
+#ifndef PTR2NV
+#  define PTR2NV(p)                      NUM2PTR(NV,p)
+#endif
 
 #undef START_EXTERN_C
 #undef END_EXTERN_C

Modified: branches/upstream/libtext-csv-xs-perl/current/t/70_rt.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtext-csv-xs-perl/current/t/70_rt.t?rev=32232&op=diff
==============================================================================
--- branches/upstream/libtext-csv-xs-perl/current/t/70_rt.t (original)
+++ branches/upstream/libtext-csv-xs-perl/current/t/70_rt.t Sat Mar 21 03:53:46 2009
@@ -4,7 +4,7 @@
 $^W = 1;
 
 #use Test::More "no_plan";
- use Test::More tests => 91;
+ use Test::More tests => 367;
 
 BEGIN {
     use_ok "Text::CSV_XS", ();
@@ -200,6 +200,55 @@
 	unlink $csv_file;
 	is_deeply ($row, [], "should return empty ref");
 	is_deeply ([ $c1, $c2], [ 1, 2 ], "fields ()");
+	}
+    }
+
+{   # http://rt.cpan.org/Ticket/Display.html?id=44402
+    # 44402 - Unexpected results parsing tab-separated spaces
+    $rt = 44402;
+    SKIP: {
+	open  FH, ">$csv_file";
+	my @ws = ("", " ", "  ");
+	foreach my $f1 (@ws) {
+	    foreach my $f2 (@ws) {
+		foreach my $f3 (@ws) {
+		    print FH "$f1\t$f2\t$f3\r\n";
+		    }
+		}
+	    }
+	close FH;
+
+	my $csv;
+	ok ($csv = Text::CSV_XS->new ({
+	    sep_char => "\t",
+	    }), "RT-$rt: $desc{$rt}");
+	open  FH, "<$csv_file";
+	while (my $row = $csv->getline (*FH)) {
+	    ok ($row, "getline $.");
+	    my @row = @$row;
+	    is ($#row, 2, "Got 3 fields");
+	    like ($row[$_], qr{^ *$}, "field $_ with only spaces") for 0..2;
+	    }
+	ok ($csv->eof, "read complete file");
+	close FH;
+
+	ok ($csv = Text::CSV_XS->new ({
+	    sep_char         => "\t",
+	    allow_whitespace => 1,
+	    }), "RT-$rt: $desc{$rt}");
+	open  FH, "<$csv_file";
+	while (my $row = $csv->getline (*FH)) {
+	    ok ($row, "getline $.");
+	    my @row = @$row;
+	    is ($#row, 2, "Got 3 fields");
+	    is ($row[$_], "", "field $_ empty") for 0..2;
+	    }
+	ok ($csv->eof, "read complete file");
+	close FH;
+	unlink $csv_file;
+
+	ok ($csv->parse ("  \t  \t  "), "parse ()");
+	is_deeply ([$csv->fields],["","",""],"3 empty fields");
 	}
     }
 
@@ -237,3 +286,4 @@
 þ0þþ1þþ2þþ3þ
 «43927» - Is bind_columns broken or am I using it wrong?
 1,2
+«44402» - Unexpected results parsing tab-separated spaces




More information about the Pkg-perl-cvs-commits mailing list