r26226 - in /trunk/libtext-csv-xs-perl: CSV_XS.pm CSV_XS.xs ChangeLog META.yml debian/changelog ppport.h t/12_acc.t t/45_eol.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Oct 25 15:50:06 UTC 2008


Author: ansgar-guest
Date: Sat Oct 25 15:50:00 2008
New Revision: 26226

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26226
Log:
New upstream release.

Modified:
    trunk/libtext-csv-xs-perl/CSV_XS.pm
    trunk/libtext-csv-xs-perl/CSV_XS.xs
    trunk/libtext-csv-xs-perl/ChangeLog
    trunk/libtext-csv-xs-perl/META.yml
    trunk/libtext-csv-xs-perl/debian/changelog
    trunk/libtext-csv-xs-perl/ppport.h
    trunk/libtext-csv-xs-perl/t/12_acc.t
    trunk/libtext-csv-xs-perl/t/45_eol.t

Modified: trunk/libtext-csv-xs-perl/CSV_XS.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/CSV_XS.pm?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/CSV_XS.pm (original)
+++ trunk/libtext-csv-xs-perl/CSV_XS.pm Sat Oct 25 15:50:00 2008
@@ -30,7 +30,7 @@
 use Carp;
 
 use vars   qw( $VERSION @ISA );
-$VERSION = "0.55";
+$VERSION = "0.57";
 @ISA     = qw( DynaLoader );
 bootstrap Text::CSV_XS $VERSION;
 
@@ -67,7 +67,6 @@
     blank_is_undef	=> 0,
     verbatim		=> 0,
     types		=> undef,
-
 
     _EOF		=> 0,
     _STATUS		=> undef,
@@ -126,10 +125,11 @@
 sub _set_attr_C
 {
     my ($self, $name, $val) = @_;
+    defined $val or $val = 0;
     $self->{$name} = $val;
     $self->{_CACHE} or return;
     my @cache = unpack "C*", $self->{_CACHE};
-    $cache[$_cache_id{$name}] = defined $val ? unpack "C", $val : 0;
+    $cache[$_cache_id{$name}] = unpack "C", $val;
     $self->{_CACHE} = pack "C*", @cache;
     } # _set_attr_C
 
@@ -137,10 +137,9 @@
 {
     my ($self, $name, $val) = @_;
     $self->{$name} = $val;
-    $self->{_CACHE} or return;
     my @cache = unpack "C*", $self->{_CACHE};
     my $i = $_cache_id{$name};
-    $cache[$i++] = $_ for unpack "C*", pack "N", defined $val ? $val : 0;
+    $cache[$i++] = $_ for unpack "C*", pack "N", $val;
     $self->{_CACHE} = pack "C*", @cache;
     } # _set_attr_N
 
@@ -172,6 +171,7 @@
     my $self = shift;
     if (@_) {
 	my $eol = shift;
+	defined $eol or $eol = "";
 	my $eol_len = length $eol;
 	$self->{eol} = $eol;
 	$self->{_CACHE} or return;
@@ -458,8 +458,6 @@
     \%hr;
     } # getline_hr
 
-bootstrap Text::CSV_XS $VERSION;
-
 sub types
 {
     my $self = shift;
@@ -530,7 +528,7 @@
 =head2 Embedded newlines
 
 B<Important Note>: The default behavior is to only accept ascii characters.
-This means that fields can not contain newlines. If your data contains 
+This means that fields can not contain newlines. If your data contains
 newlines embedded in fields, or characters above 0x7e (tilde), or binary data,
 you *must* set C<< binary => 1 >> in the call to C<new ()>.  To cover the widest
 range of parsing options, you will always want to set binary.
@@ -558,7 +556,7 @@
  open my $io, "<", $file or die "$file: $!";
  while (my $row = $csv->getline ($io)) {
      my @fields = @$row;
- 
+
 =head2 Unicode (UTF8)
 
 On parsing (both for C<getline ()> and C<parse ()>), if the source is
@@ -567,6 +565,22 @@
 
 On combining (C<print ()> and C<combine ()>), if any of the combining
 fields was marked UTF8, the resulting string will be marked UTF8.
+
+For complete control over encoding, please use Text::CSV::Encoded:
+
+    use Text::CSV::Encoded;
+    my $csv = Text::CSV::Encoded->new ({
+        encoding_in  => "iso-8859-1", # the encoding comes into   Perl
+        encoding_out => "cp1252",     # the encoding comes out of Perl
+        });
+
+    $csv = Text::CSV::Encoded->new ({ encoding  => "utf8" });
+    # combine () and print () accept *literally* utf8 encoded data
+    # parse () and getline () return *literally* utf8 encoded data
+
+    $csv = Text::CSV::Encoded->new ({ encoding  => undef }); # default
+    # combine () and print () accept UTF8 marked data
+    # parse () and getline () return UTF8 marked data
 
 =head1 SPECIFICATION
 
@@ -666,9 +680,10 @@
 
 =item eol
 
-An end-of-line string to add to rows, usually C<undef> (nothing,
-default = C<$\>), C<"\012"> (Line Feed) or C<"\015\012"> (Carriage
-Return, Line Feed). Cannot be longer than 7 (ASCII) characters.
+An end-of-line string to add to rows. C<undef> is replaced with an
+empty string. The default is C<$\>. Common values for C<eol> are
+C<"\012"> (Line Feed) or C<"\015\012"> (Carriage Return, Line Feed).
+Cannot be longer than 7 (ASCII) characters.
 
 If both C<$/> and C<eol> equal C<"\015">, parsing lines that end on
 only a Carriage Return without Line Feed, will be C<parse>d correct.
@@ -773,7 +788,7 @@
   "foo","bar","Escape ""quote mark"" with two ""quote marks""","baz"
 
 If you change the default quote_char without changing the default
-escape_char, the escape_char will still be the quote mark.  If instead 
+escape_char, the escape_char will still be the quote mark.  If instead
 you want to escape the quote_char by doubling it, you will need to change
 the escape_char to be the same as what you changed the quote_char to.
 
@@ -976,7 +991,7 @@
 
 The C<getline_hr ()> and C<column_names ()> methods work together to allow
 you to have rows returned as hashrefs. You must call C<column_names ()>
-first to declare your column names. 
+first to declare your column names.
 
  $csv->column_names (qw( code name price description ));
  $hr = $csv->getline_hr ($io);
@@ -1312,17 +1327,6 @@
 We probably need many more tests to check if all edge-cases are covered.
 See t/50_utf8.t.
 
-Probably the best way to do this more reliable is to make a subclass
-Text::CSV_XS::Encoded that can be passed the required encoding and
-then behaves transparently (but slower), something like this:
-
-    use Text::CSV::Encoded;
-    my $csv = Text::CSV::Encoded->new ({
-        encoding     => "utf-8",      # Both in and out
-        encoding_in  => "iso-8859-1", # Only the input
-        encoding_out => "cp1252",     # Only the output
-        });
-
 =item Parse the whole file at once
 
 Implement a new methods that enables the parsing of a complete file
@@ -1365,11 +1369,6 @@
 
 =item next + 1
 
- - allow_double_quoted
- - Text::CSV_XS::Encoded (maybe)
-
-=item next + 2
-
  - csv2csv - a script to regenerate a CSV file to follow standards
  - EBCDIC support
 
@@ -1521,8 +1520,8 @@
 =head1 SEE ALSO
 
 L<perl(1)>, L<IO::File(3)>, L<IO::Handle(3)>, L<IO::Wrap(3)>,
-L<Text::CSV(3)>, L<Text::CSV_PP(3)>, L<Text::CSV::Separator(3)>,
-and L<Spreadsheet::Read(3)>.
+L<Text::CSV(3)>, L<Text::CSV_PP(3)>, L<Text::CSV::Encoded>,
+L<Text::CSV::Separator(3)>, and L<Spreadsheet::Read(3)>.
 
 =head1 AUTHORS and MAINTAINERS
 

Modified: trunk/libtext-csv-xs-perl/CSV_XS.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/CSV_XS.xs?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/CSV_XS.xs (original)
+++ trunk/libtext-csv-xs-perl/CSV_XS.xs Sat Oct 25 15:50:00 2008
@@ -1138,10 +1138,22 @@
 static int xsCombine (HV *hv, AV *av, SV *io, bool useIO)
 {
     csv_t	csv;
+    int		result;
+#if (PERL_BCDVERSION >= 0x5008000)
+    SV		*ors = PL_ors_sv;
+#endif
 
     SetupCsv (&csv, hv);
     csv.useIO = useIO;
-    return Combine (&csv, io, av);
+#if (PERL_BCDVERSION >= 0x5008000)
+    if (*csv.eol)
+	PL_ors_sv = &PL_sv_undef;
+#endif
+    result = Combine (&csv, io, av);
+#if (PERL_BCDVERSION >= 0x5008000)
+    PL_ors_sv = ors;
+#endif
+    return result;
     } /* xsCombine */
 
 MODULE = Text::CSV_XS		PACKAGE = Text::CSV_XS

Modified: trunk/libtext-csv-xs-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/ChangeLog?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/ChangeLog (original)
+++ trunk/libtext-csv-xs-perl/ChangeLog Sat Oct 25 15:50:00 2008
@@ -1,3 +1,21 @@
+2008-10-21 0.57 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+	* Don't bootstrap twice. Don't know how/when it came in there
+
+2008-10-21 0.56 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+	* Update to ppport.h 3.14_01
+	* Updated docs (Unicode, TODO, Release Plan)
+	* As Text::CSV::Encoded is about to be released, refer to it
+	  in the documentation
+	* Default for eol is "", undef now treated as ""
+	* Don't print $\ twice (eol prevails over $\ in ->print ())
+	  Fix only works in perl5.8 and up
+	* Undef treated as 0 for boolean attributes
+	* Trailing whitespace in pod removed
+	* Sync up doc with latest Text::CSV::Encoded
+	* YAML declared 1.4 (META.yml) instead of 1.1 (YAML)
+
 2008-10-15 0.55 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
 	* Improve documentation on eol

Modified: trunk/libtext-csv-xs-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/META.yml?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/META.yml (original)
+++ trunk/libtext-csv-xs-perl/META.yml Sat Oct 25 15:50:00 2008
@@ -1,6 +1,6 @@
---- #YAML:1.4
+--- #YAML:1.1
 name:              Text-CSV_XS
-version:           0.55
+version:           0.57
 abstract:          Comma-Separated Values manipulation routines
 license:           perl
 author:              
@@ -10,7 +10,7 @@
 provides:
     Text::CSV_XS:
         file:      CSV_XS.pm
-        version:   0.55
+        version:   0.57
 requires:     
     perl:          5.005
     DynaLoader:    0

Modified: trunk/libtext-csv-xs-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/debian/changelog?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/debian/changelog (original)
+++ trunk/libtext-csv-xs-perl/debian/changelog Sat Oct 25 15:50:00 2008
@@ -1,3 +1,9 @@
+libtext-csv-xs-perl (0.57-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 25 Oct 2008 17:49:46 +0200
+
 libtext-csv-xs-perl (0.55-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libtext-csv-xs-perl/ppport.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/ppport.h?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/ppport.h (original)
+++ trunk/libtext-csv-xs-perl/ppport.h Sat Oct 25 15:50:00 2008
@@ -4,9 +4,9 @@
 /*
 ----------------------------------------------------------------------
 
-    ppport.h -- Perl/Pollution/Portability Version 3.13_01
-
-    Automatically created by Devel::PPPort running under perl 5.010000.
+    ppport.h -- Perl/Pollution/Portability Version 3.14_01
+
+    Automatically created by Devel::PPPort running under perl 5.011000.
 
     Do NOT edit this file directly! -- Edit PPPort_pm.PL and the
     includes in parts/inc/ instead.
@@ -21,7 +21,7 @@
 
 =head1 NAME
 
-ppport.h - Perl/Pollution/Portability version 3.13_01
+ppport.h - Perl/Pollution/Portability version 3.14_01
 
 =head1 SYNOPSIS
 
@@ -372,7 +372,7 @@
 # Disable broken TRIE-optimization
 BEGIN { eval '${^RE_TRIE_MAXBUF} = -1' if $] >= 5.009004 && $] <= 5.009005 }
 
-my $VERSION = 3.13_01;
+my $VERSION = 3.14_01;
 
 my %opt = (
   quiet     => 0,
@@ -537,6 +537,7 @@
 PAD_COMPNAME_OURSTASH|||
 PAD_COMPNAME_PV|||
 PAD_COMPNAME_TYPE|||
+PAD_DUP|||
 PAD_RESTORE_LOCAL|||
 PAD_SAVE_LOCAL|||
 PAD_SAVE_SETNULLPAD|||
@@ -545,6 +546,8 @@
 PAD_SET_CUR|||
 PAD_SVl|||
 PAD_SV|||
+PERLIO_FUNCS_CAST|5.009003||p
+PERLIO_FUNCS_DECL|5.009003||p
 PERL_ABS|5.008001||p
 PERL_BCDVERSION|5.011000||p
 PERL_GCC_BRACE_GROUPS_FORBIDDEN|5.008001||p
@@ -788,6 +791,7 @@
 SvNVx|||
 SvNV|||
 SvOK|||
+SvOOK_offset||5.011000|
 SvOOK|||
 SvPOK_off|||
 SvPOK_only_UTF8||5.006000|
@@ -1060,7 +1064,6 @@
 ck_grep|||
 ck_index|||
 ck_join|||
-ck_lengthconst|||
 ck_lfun|||
 ck_listiob|||
 ck_match|||
@@ -1070,7 +1073,6 @@
 ck_readline|||
 ck_repeat|||
 ck_require|||
-ck_retarget|||
 ck_return|||
 ck_rfun|||
 ck_rvconst|||
@@ -1100,6 +1102,7 @@
 cr_textfilter|||
 create_eval_scope|||
 croak_nocontext|||vn
+croak_xs_usage||5.011000|
 croak|||v
 csighandler||5.009003|n
 curmad|||
@@ -1254,6 +1257,7 @@
 fbm_instr||5.005000|
 fd_on_nosuid_fs|||
 feature_is_enabled|||
+fetch_cop_label||5.011000|
 filter_add|||
 filter_del|||
 filter_gets|||
@@ -1336,6 +1340,7 @@
 gv_fetchfile|||
 gv_fetchmeth_autoload||5.007003|
 gv_fetchmethod_autoload||5.004000|
+gv_fetchmethod_flags||5.011000|
 gv_fetchmethod|||
 gv_fetchmeth|||
 gv_fetchpvn_flags||5.009002|
@@ -1523,6 +1528,7 @@
 magic_clear_all_env|||
 magic_clearenv|||
 magic_clearhint|||
+magic_clearisa|||
 magic_clearpack|||
 magic_clearsig|||
 magic_dump||5.006000|
@@ -1576,6 +1582,7 @@
 make_matcher|||
 make_trie_failtable|||
 make_trie|||
+malloc_good_size|||n
 malloced_size|||n
 malloc||5.007002|n
 markstack_grow|||
@@ -1880,6 +1887,7 @@
 refcounted_he_chain_2hv|||
 refcounted_he_fetch|||
 refcounted_he_free|||
+refcounted_he_new_common|||
 refcounted_he_new|||
 refcounted_he_value|||
 refkids|||
@@ -1903,7 +1911,6 @@
 reg_recode|||
 reg_scan_name|||
 reg_skipcomment|||
-reg_stringify||5.009005|
 reg_temp_copy|||
 reganode|||
 regatom|||
@@ -1992,7 +1999,7 @@
 save_mortalizesv||5.007001|
 save_nogv|||
 save_op|||
-save_padsv||5.007001|
+save_padsv_and_mortalize||5.011000|
 save_pptr|||
 save_re_context||5.006000|
 save_scalar_at|||
@@ -2069,6 +2076,7 @@
 start_subparse||5.004000|
 stashpv_hvname_match||5.011000|
 stdize_locale|||
+store_cop_label|||
 strEQ|||
 strGE|||
 strGT|||
@@ -2152,6 +2160,7 @@
 sv_grow|||
 sv_i_ncmp|||
 sv_inc|||
+sv_insert_flags||5.011000|
 sv_insert|||
 sv_isa|||
 sv_isobject|||
@@ -3808,6 +3817,16 @@
     } STMT_END
 #endif
 
+#ifndef PERLIO_FUNCS_DECL
+# ifdef PERLIO_FUNCS_CONST
+#  define PERLIO_FUNCS_DECL(funcs) const PerlIO_funcs funcs
+#  define PERLIO_FUNCS_CAST(funcs) (PerlIO_funcs*)(funcs)
+# else
+#  define PERLIO_FUNCS_DECL(funcs) PerlIO_funcs funcs
+#  define PERLIO_FUNCS_CAST(funcs) (funcs)
+# endif
+#endif
+
 #ifndef PERL_SIGNALS_UNSAFE_FLAG
 
 #define PERL_SIGNALS_UNSAFE_FLAG 0x0001
@@ -4369,7 +4388,8 @@
 
 #ifndef NVef
 #  if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
-      defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */
+      defined(PERL_PRIfldbl) && (PERL_BCDVERSION != 0x5006000)
+            /* Not very likely, but let's try anyway. */
 #    define NVef          PERL_PRIeldbl
 #    define NVff          PERL_PRIfldbl
 #    define NVgf          PERL_PRIgldbl
@@ -4466,10 +4486,10 @@
 #ifndef newSVpvn_flags
 
 #if defined(NEED_newSVpvn_flags)
-static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char * s, STRLEN len, U32 flags);
+static SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags);
 static
 #else
-extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char * s, STRLEN len, U32 flags);
+extern SV * DPPP_(my_newSVpvn_flags)(pTHX_ const char *s, STRLEN len, U32 flags);
 #endif
 
 #ifdef newSVpvn_flags
@@ -4517,10 +4537,10 @@
 #if (PERL_BCDVERSION < 0x5007000)
 
 #if defined(NEED_sv_2pvbyte)
-static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV * sv, STRLEN * lp);
+static char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp);
 static
 #else
-extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV * sv, STRLEN * lp);
+extern char * DPPP_(my_sv_2pvbyte)(pTHX_ SV *sv, STRLEN *lp);
 #endif
 
 #ifdef sv_2pvbyte
@@ -4614,10 +4634,10 @@
 #if (PERL_BCDVERSION < 0x5007002)
 
 #if defined(NEED_sv_2pv_flags)
-static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+static char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
 static
 #else
-extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+extern char * DPPP_(my_sv_2pv_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
 #endif
 
 #ifdef sv_2pv_flags
@@ -4638,10 +4658,10 @@
 #endif
 
 #if defined(NEED_sv_pvn_force_flags)
-static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+static char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
 static
 #else
-extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV * sv, STRLEN * lp, I32 flags);
+extern char * DPPP_(my_sv_pvn_force_flags)(pTHX_ SV *sv, STRLEN *lp, I32 flags);
 #endif
 
 #ifdef sv_pvn_force_flags
@@ -4662,6 +4682,12 @@
 #endif
 
 #endif
+
+#if (PERL_BCDVERSION < 0x5008008) || ( (PERL_BCDVERSION >= 0x5009000) && (PERL_BCDVERSION < 0x5009003) )
+# define DPPP_SVPV_NOLEN_LP_ARG &PL_na
+#else
+# define DPPP_SVPV_NOLEN_LP_ARG 0
+#endif
 #ifndef SvPV_const
 #  define SvPV_const(sv, lp)             SvPV_flags_const(sv, lp, SV_GMAGIC)
 #endif
@@ -4684,7 +4710,7 @@
 #  define SvPV_flags_const_nolen(sv, flags) \
                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
                   ? SvPVX_const(sv) : \
-                  (const char*) sv_2pv_flags(sv, 0, flags|SV_CONST_RETURN))
+                  (const char*) sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags|SV_CONST_RETURN))
 #endif
 #ifndef SvPV_flags_mutable
 #  define SvPV_flags_mutable(sv, lp, flags) \
@@ -4719,7 +4745,7 @@
 #ifndef SvPV_force_flags_nolen
 #  define SvPV_force_flags_nolen(sv, flags) \
                  ((SvFLAGS(sv) & (SVf_POK|SVf_THINKFIRST)) == SVf_POK \
-                 ? SvPVX(sv) : sv_pvn_force_flags(sv, 0, flags))
+                 ? SvPVX(sv) : sv_pvn_force_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, flags))
 #endif
 #ifndef SvPV_force_flags_mutable
 #  define SvPV_force_flags_mutable(sv, lp, flags) \
@@ -4730,12 +4756,12 @@
 #ifndef SvPV_nolen
 #  define SvPV_nolen(sv)                 \
                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
-                  ? SvPVX(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC))
+                  ? SvPVX(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC))
 #endif
 #ifndef SvPV_nolen_const
 #  define SvPV_nolen_const(sv)           \
                  ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
-                  ? SvPVX_const(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC|SV_CONST_RETURN))
+                  ? SvPVX_const(sv) : sv_2pv_flags(sv, DPPP_SVPV_NOLEN_LP_ARG, SV_GMAGIC|SV_CONST_RETURN))
 #endif
 #ifndef SvPV_nomg
 #  define SvPV_nomg(sv, lp)              SvPV_flags(sv, lp, 0)
@@ -4807,10 +4833,10 @@
 
 #if (PERL_BCDVERSION >= 0x5004000) && !defined(vnewSVpvf)
 #if defined(NEED_vnewSVpvf)
-static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
+static SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args);
 static
 #else
-extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char * pat, va_list * args);
+extern SV * DPPP_(my_vnewSVpvf)(pTHX_ const char *pat, va_list *args);
 #endif
 
 #ifdef vnewSVpvf
@@ -4842,10 +4868,10 @@
 
 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg)
 #if defined(NEED_sv_catpvf_mg)
-static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+static void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
 static
 #else
-extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+extern void DPPP_(my_sv_catpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
 #endif
 
 #define Perl_sv_catpvf_mg DPPP_(my_sv_catpvf_mg)
@@ -4868,10 +4894,10 @@
 #ifdef PERL_IMPLICIT_CONTEXT
 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_catpvf_mg_nocontext)
 #if defined(NEED_sv_catpvf_mg_nocontext)
-static void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+static void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...);
 static
 #else
-extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+extern void DPPP_(my_sv_catpvf_mg_nocontext)(SV *sv, const char *pat, ...);
 #endif
 
 #define sv_catpvf_mg_nocontext DPPP_(my_sv_catpvf_mg_nocontext)
@@ -4913,10 +4939,10 @@
 
 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg)
 #if defined(NEED_sv_setpvf_mg)
-static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+static void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
 static
 #else
-extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV * sv, const char * pat, ...);
+extern void DPPP_(my_sv_setpvf_mg)(pTHX_ SV *sv, const char *pat, ...);
 #endif
 
 #define Perl_sv_setpvf_mg DPPP_(my_sv_setpvf_mg)
@@ -4939,10 +4965,10 @@
 #ifdef PERL_IMPLICIT_CONTEXT
 #if (PERL_BCDVERSION >= 0x5004000) && !defined(sv_setpvf_mg_nocontext)
 #if defined(NEED_sv_setpvf_mg_nocontext)
-static void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+static void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...);
 static
 #else
-extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV * sv, const char * pat, ...);
+extern void DPPP_(my_sv_setpvf_mg_nocontext)(SV *sv, const char *pat, ...);
 #endif
 
 #define sv_setpvf_mg_nocontext DPPP_(my_sv_setpvf_mg_nocontext)

Modified: trunk/libtext-csv-xs-perl/t/12_acc.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/t/12_acc.t?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/t/12_acc.t (original)
+++ trunk/libtext-csv-xs-perl/t/12_acc.t Sat Oct 25 15:50:00 2008
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;	# use warnings core since 5.6
 
-use Test::More tests => 44;
+use Test::More tests => 47;
 
 BEGIN {
     use_ok "Text::CSV_XS";
@@ -34,8 +34,11 @@
 
 is ($csv->sep_char (";"),		';',		"sep_char (;)");
 is ($csv->quote_char ("="),		'=',		"quote_char (=)");
+is ($csv->eol (undef),			"",		"eol (undef)");
+is ($csv->eol (""),			"",		"eol ('')");
 is ($csv->eol ("\r"),			"\r",		"eol (\\r)");
 is ($csv->keep_meta_info (1),		1,		"keep_meta_info (1)");
+is ($csv->always_quote (undef),		0,		"always_quote (undef)");
 is ($csv->always_quote (1),		1,		"always_quote (1)");
 is ($csv->allow_loose_quotes (1),	1,		"allow_loose_quotes (1)");
 is ($csv->allow_loose_escapes (1),	1,		"allow_loose_escapes (1)");

Modified: trunk/libtext-csv-xs-perl/t/45_eol.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtext-csv-xs-perl/t/45_eol.t?rev=26226&op=diff
==============================================================================
--- trunk/libtext-csv-xs-perl/t/45_eol.t (original)
+++ trunk/libtext-csv-xs-perl/t/45_eol.t Sat Oct 25 15:50:00 2008
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 133;
+use Test::More tests => 255;
 
 BEGIN {
     require_ok "Text::CSV_XS";
@@ -16,56 +16,58 @@
 # Embedded newline tests
 
 foreach my $rs ("\n", "\r\n", "\r") {
+    for $\ (undef, $rs) {
 
-    my $csv = Text::CSV_XS->new ({ binary => 1 });
-       $csv->eol ($/ = $rs);
+	my $csv = Text::CSV_XS->new ({ binary => 1 });
+	   $csv->eol ($/ = $rs) unless defined $\;
 
-    foreach my $pass (0, 1) {
-	if ($pass == 0) {
-	    open FH, ">_eol.csv";
-	    }
-	else {
-	    open FH, "<_eol.csv";
+	foreach my $pass (0, 1) {
+	    if ($pass == 0) {
+		open FH, ">_eol.csv";
+		}
+	    else {
+		open FH, "<_eol.csv";
+		}
+
+	    foreach my $eol ("", "\r", "\n", "\r\n", "\n\r") {
+		my $s_eol = join " - ", map { defined $_ ? $_ : "<undef>" } $\, $rs, $eol;
+		   $s_eol =~ s/\r/\\r/g;
+		   $s_eol =~ s/\n/\\n/g;
+
+		my @p;
+		my @f = ("", 1,
+		    $eol, " $eol", "$eol ", " $eol ", "'$eol'",
+		    "\"$eol\"", " \" $eol \"\n ", "EOL");
+
+		if ($pass == 0) {
+		    ok ($csv->combine (@f),			"combine |$s_eol|");
+		    ok (my $str = $csv->string,		"string  |$s_eol|");
+		    my $state = $csv->parse ($str);
+		    ok ($state,				"parse   |$s_eol|");
+		    if ($state) {
+			ok (@p = $csv->fields,		"fields  |$s_eol|");
+			}
+		    else{
+			is ($csv->error_input, $str,	"error   |$s_eol|");
+			}
+
+		    print FH $str;
+		    }
+		else {
+		    ok (my $row = $csv->getline (*FH),	"getline |$s_eol|");
+		    is (ref $row, "ARRAY",			"row     |$s_eol|");
+		    @p = @$row;
+		    }
+
+		local $, = "|";
+		is_binary ("@p", "@f",			"result  |$s_eol|");
+		}
+
+	    close FH;
 	    }
 
-	foreach my $eol ("", "\r", "\n", "\r\n", "\n\r") {
-	    my $s_eol = "$rs - $eol";
-	       $s_eol =~ s/\r/\\r/g;
-	       $s_eol =~ s/\n/\\n/g;
-
-	    my @p;
-	    my @f = ("", 1,
-		$eol, " $eol", "$eol ", " $eol ", "'$eol'",
-		"\"$eol\"", " \" $eol \"\n ", "EOL");
-
-	    if ($pass == 0) {
-		ok ($csv->combine (@f),			"combine |$s_eol|");
-		ok (my $str = $csv->string,		"string  |$s_eol|");
-		my $state = $csv->parse ($str);
-		ok ($state,				"parse   |$s_eol|");
-		if ($state) {
-		    ok (@p = $csv->fields,		"fields  |$s_eol|");
-		    }
-		else{
-		    is ($csv->error_input, $str,	"error   |$s_eol|");
-		    }
-
-		print FH $str;
-		}
-	    else {
-		ok (my $row = $csv->getline (*FH),	"getline |$s_eol|");
-		is (ref $row, "ARRAY",			"row     |$s_eol|");
-		@p = @$row;
-		}
-
-	    local $, = "|";
-	    is_binary ("@p", "@f",			"result  |$s_eol|");
-	    }
-
-	close FH;
+	unlink "_eol.csv";
 	}
-
-    unlink "_eol.csv";
     }
 
 {   my $csv = Text::CSV_XS->new ({ escape_char => undef });
@@ -77,6 +79,32 @@
 
     ok ($csv->allow_whitespace (1), "Allow whitespace");
     ok ($csv->parse (qq{"x" \r}),  "Trailing \\r with no escape char");
+    }
+
+SKIP: {
+    $] < 5.008 and skip "\$\\ tests don't work in perl 5.6.x and older", 2;
+    {   local $\ = "#\r\n";
+	my $csv = Text::CSV_XS->new ();
+	open  FH, ">_eol.csv";
+	$csv->print (*FH, [ "a", 1 ]);
+	close FH;
+	open  FH, "<_eol.csv";
+	local $/;
+	is (<FH>, "a,1#\r\n", "Strange \$\\");
+	close FH;
+	unlink "_eol.csv";
+	}
+    {   local $\ = "#\r\n";
+	my $csv = Text::CSV_XS->new ({ eol => $\ });
+	open  FH, ">_eol.csv";
+	$csv->print (*FH, [ "a", 1 ]);
+	close FH;
+	open  FH, "<_eol.csv";
+	local $/;
+	is (<FH>, "a,1#\r\n", "Strange \$\\ + eol");
+	close FH;
+	unlink "_eol.csv";
+	}
     }
 
 ok (1, "Specific \\r test from tfrayner");




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