Hello community,

here is the log from the commit of package perl-Text-CSV for openSUSE:Factory 
checked in at 2015-04-22 08:22:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Text-CSV (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Text-CSV.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Text-CSV"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Text-CSV/perl-Text-CSV.changes      
2013-07-31 17:24:41.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Text-CSV.new/perl-Text-CSV.changes 
2015-04-22 08:22:26.000000000 +0200
@@ -1,0 +2,20 @@
+Tue Apr 14 21:12:13 UTC 2015 - [email protected]
+
+- updated to 1.33
+   see /usr/share/doc/packages/perl-Text-CSV/Changes
+
+  1.33  Tue Mar  3 14:13:41 2015
+       - Fix some reported bugs with handling fields with zeros.
+          https://rt.cpan.org/Public/Bug/Display.html?id=93518
+          https://rt.cpan.org/Public/Bug/Display.html?id=92509
+                                             patched by shlomif
+       - catch up Text::CSV_XS 1.02
+           * add decode_utf8 attribute by ktat
+       - fix warnings: $. is undefined by ktat
+       - typo fixes in doc by anirvan, dsteinbrunner and pdl.
+       - parse() supports bind_columns()
+  
+       * TODO: Updating documents and adding diag_verbose in the next version.
+               Catching up CSV_XS 1.04.
+
+-------------------------------------------------------------------

Old:
----
  Text-CSV-1.32.tar.gz

New:
----
  Text-CSV-1.33.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Text-CSV.spec ++++++
--- /var/tmp/diff_new_pack.JazgOS/_old  2015-04-22 08:22:27.000000000 +0200
+++ /var/tmp/diff_new_pack.JazgOS/_new  2015-04-22 08:22:27.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Text-CSV
 #
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Text-CSV
-Version:        1.32
+Version:        1.33
 Release:        0
 %define cpan_name Text-CSV
 Summary:        comma-separated values manipulator (using XS or PurePerl)
@@ -29,7 +29,6 @@
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  perl
 BuildRequires:  perl-macros
-#BuildRequires: perl(Text::CSV)
 %{perl_requires}
 
 %description
@@ -46,6 +45,7 @@
 
 %prep
 %setup -q -n %{cpan_name}-%{version}
+find . -type f -print0 | xargs -0 chmod 644
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor

++++++ Text-CSV-1.32.tar.gz -> Text-CSV-1.33.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/Changes new/Text-CSV-1.33/Changes
--- old/Text-CSV-1.32/Changes   2013-06-13 08:36:38.000000000 +0200
+++ new/Text-CSV-1.33/Changes   2015-03-03 18:13:23.000000000 +0100
@@ -1,5 +1,19 @@
 Revision history for Perl extension Text::CSV.
 
+1.33  Tue Mar  3 14:13:41 2015
+       - Fix some reported bugs with handling fields with zeros.
+          https://rt.cpan.org/Public/Bug/Display.html?id=93518
+          https://rt.cpan.org/Public/Bug/Display.html?id=92509
+                                             patched by shlomif
+       - catch up Text::CSV_XS 1.02
+           * add decode_utf8 attribute by ktat
+       - fix warnings: $. is undefined by ktat
+       - typo fixes in doc by anirvan, dsteinbrunner and pdl.
+       - parse() supports bind_columns()
+
+       * TODO: Updating documents and adding diag_verbose in the next version.
+               Catching up CSV_XS 1.04.
+
 1.32
        - fix t/rt71_pp.t
 
@@ -9,8 +23,6 @@
        - add allow_unquoted_escape
        - fix parsing escapted sep char (found in Text::CSV_XS rt#81295)
 
-       * TODO: Updating documents and adding diag_verbose in the next version
-
 1.30  Tue Jun 11 00:06:02 2013
        - catch up Text::CSV_XS 0.99
            (except for diag_verbose and allow_unquoted_escape)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/MANIFEST new/Text-CSV-1.33/MANIFEST
--- old/Text-CSV-1.32/MANIFEST  2013-06-13 08:47:00.000000000 +0200
+++ new/Text-CSV-1.33/MANIFEST  2015-03-03 18:40:32.000000000 +0100
@@ -1,40 +1,37 @@
 Changes
+files/macosx.csv               A CSV files exported on MacOSX
+files/utf8.csv                 A UTF-8 encode test file
 lib/Text/CSV.pm
 lib/Text/CSV_PP.pm
 Makefile.PL
 MANIFEST
 README
-
-# test suits are copied and modified from Text::CSV_XS
-
-t/00_pod.t             Check if pod is valid
-t/10_base.t            Base tests (combine and parse only)
-t/12_acc.t             Accessor methods
-t/15_flags.t           Basic flag tests
-t/20_file.t            IO tests (print and getline) global  handles
-t/21_lexicalio.t       IO tests (print and getline) lexical handles
-t/22_scalario.t                IO tests (print and getline) scalar io (perlio)
-t/30_types.t           Tests for the "types" attribute.
-t/40_misc.t            Binary mode tests
-t/41_null.t            NULL test in combination with line endings
-t/45_eol.t             Embedded EOL
-t/46_eol_si.t          Embedded EOL using scalar io (perlio)
-t/50_utf8.t            Unicode stress tests
-t/51_utf8.t            Unicode IO encoding tests
-t/55_combi.t           Different CSV character combinations
-t/60_samples.t         Miscellaneous problems from the modules history.
-t/65_allow.t           Allow bad formats
-t/70_rt.t              Tests based on RT reports (for Text::CSV_XS)
-t/71_pp.t              Tests for bug report fixes or patches (for Text::CSV_PP)
-t/75_hashref.t          getline_hr related tests
-t/76_magic.t            array_ref from magig (useless for Text::CSV_PP)
-t/77_getall.t          gat all rows at once
-t/80_diag.t            Error diagnostics
-t/81_subclass.t                Subclassed
-
-files/macosx.csv       A CSV files exported on MacOSX
-files/utf8.csv         A UTF-8 encode test file
-
-t/util.pl              Extra test utilities
-META.yml                                 Module meta-data (added by MakeMaker)
+t/00_pod.t                     Check if pod is valid
+t/10_base.t                    Base tests (combine and parse only)
+t/12_acc.t                     Accessor methods
+t/15_flags.t                   Basic flag tests
+t/20_file.t                    IO tests (print and getline) global  handles
+t/21_lexicalio.t               IO tests (print and getline) lexical handles
+t/22_scalario.t                        IO tests (print and getline) scalar io 
(perlio)
+t/30_types.t                   Tests for the "types" attribute.
+t/40_misc.t                    Binary mode tests
+t/41_null.t                    NULL test in combination with line endings
+t/45_eol.t                     Embedded EOL
+t/46_eol_si.t                  Embedded EOL using scalar io (perlio)
+t/50_utf8.t                    Unicode stress tests
+t/51_utf8.t                    Unicode IO encoding tests
+t/55_combi.t                   Different CSV character combinations
+t/60_samples.t                 Miscellaneous problems from the modules history.
+t/65_allow.t                   Allow bad formats
+t/70_rt.t                      Tests based on RT reports (for Text::CSV_XS)
+t/71_pp.t                      Tests for bug report fixes or patches (for 
Text::CSV_PP)
+t/75_hashref.t                 getline_hr related tests
+t/76_magic.t                   array_ref from magig (useless for Text::CSV_PP)
+t/77_getall.t                  gat all rows at once
+t/80_diag.t                    Error diagnostics
+t/81_subclass.t                        Subclassed
+t/fields_containing_0.t                Tests
+t/rt99774.t
+t/util.pl                      Extra test utilities
+META.yml                                 Module YAML meta-data (added by 
MakeMaker)
 META.json                                Module JSON meta-data (added by 
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/META.json new/Text-CSV-1.33/META.json
--- old/Text-CSV-1.32/META.json 2013-06-13 08:47:00.000000000 +0200
+++ new/Text-CSV-1.33/META.json 2015-03-03 18:40:32.000000000 +0100
@@ -4,7 +4,7 @@
       "Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter 
version 2.130880",
+   "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter 
version 2.140640",
    "license" : [
       "perl_5"
    ],
@@ -44,5 +44,5 @@
          "url" : "http://github.com/makamaka/Text-CSV";
       }
    },
-   "version" : "1.32"
+   "version" : "1.33"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/META.yml new/Text-CSV-1.33/META.yml
--- old/Text-CSV-1.32/META.yml  2013-06-13 08:47:00.000000000 +0200
+++ new/Text-CSV-1.33/META.yml  2015-03-03 18:40:32.000000000 +0100
@@ -3,24 +3,24 @@
 author:
   - 'Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>'
 build_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 
2.130880'
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 
2.140640'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Text-CSV
 no_index:
   directory:
     - t
     - inc
 requires:
-  IO::Handle: 0
-  Test::Harness: 0
-  Test::More: 0
+  IO::Handle: '0'
+  Test::Harness: '0'
+  Test::More: '0'
 resources:
   repository: http://github.com/makamaka/Text-CSV
-version: 1.32
+version: '1.33'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/README new/Text-CSV-1.33/README
--- old/Text-CSV-1.32/README    2013-06-10 17:12:22.000000000 +0200
+++ new/Text-CSV-1.33/README    2015-03-03 18:13:23.000000000 +0100
@@ -1,4 +1,4 @@
-Text::CSV version 1.30
+Text::CSV version 1.33
 ========================
 
 comma-separated values manipulator
@@ -31,7 +31,7 @@
 COPYRIGHT AND LICENSE
 
         Copyright (C) 1997 Alan Citterman. All rights reserved.
-        Copyright (C) 2007-2013 Makamaka Hannyaharamitu. All rights reserved.
+        Copyright (C) 2007-2015 Makamaka Hannyaharamitu. All rights reserved.
 
         This library is free software; you can redistribute it and/or modify
         it under the same terms as Perl itself.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/lib/Text/CSV.pm 
new/Text-CSV-1.33/lib/Text/CSV.pm
--- old/Text-CSV-1.32/lib/Text/CSV.pm   2013-06-13 08:37:27.000000000 +0200
+++ new/Text-CSV-1.33/lib/Text/CSV.pm   2015-03-03 18:13:23.000000000 +0100
@@ -6,14 +6,14 @@
 use vars qw( $VERSION $DEBUG );
 
 BEGIN {
-    $VERSION = '1.32';
+    $VERSION = '1.33';
     $DEBUG   = 0;
 }
 
 # if use CSV_XS, requires version
 my $Module_XS  = 'Text::CSV_XS';
 my $Module_PP  = 'Text::CSV_PP';
-my $XS_Version = '0.99';
+my $XS_Version = '1.02';
 
 my $Is_Dynamic = 0;
 
@@ -288,10 +288,10 @@
 
 =head1 VERSION
 
-    1.32
+    1.33
 
-This module is compatible with Text::CSV_XS B<0.99> and later.
-(except for diag_verbose and allow_unquoted_escape)
+This module is compatible with Text::CSV_XS B<1.02> and later.
+(except for diag_verbose)
 
 =head2 Embedded newlines
 
@@ -366,7 +366,7 @@
 
 =head1 FUNCTIONS
 
-These methods are common between XS and puer Perl version.
+These methods are common between the XS and the pure Perl version.
 Most of the document was shamelessly copied and replaced from Text::CSV_XS.
 
 =head2 version ()
@@ -543,6 +543,24 @@
 string like C<"\x{00a0}"> might still be binary, but not marked UTF8, so
 setting C<{ binary =E<gt> 1 }> is still a wise option.
 
+=item decode_utf8
+
+This attributes defaults to TRUE.
+
+While I<parsing>,  fields that are valid UTF-8, are automatically set to be
+UTF-8, so that
+
+  $csv->parse ("\xC4\xA8\n");
+
+results in
+
+  PV("\304\250"\0) [UTF8 "\x{128}"]
+
+Sometimes it might not be a desired action.  To prevent those upgrades, set
+this attribute to false, and the result will be
+
+  PV("\304\250"\0)
+
 =item types
 
 A set of column types; this attribute is immediately passed to the
@@ -607,7 +625,7 @@
 where, the line ending is a very specific "#\r\n", and the sep_char
 is a ^ (caret). None of the fields is quoted, but embedded binary
 data is likely to be present. With the specific line ending, that
-shouldn not be too hard to detect.
+should not be too hard to detect.
 
 By default, Text::CSV' parse function however is instructed to only
 know about "\n" and "\r" to be legal line endings, and so has to deal
@@ -647,6 +665,7 @@
      quote_space         => 1,
      quote_null          => 1,
      binary              => 0,
+     decode_utf8         => 0,
      keep_meta_info      => 0,
      allow_loose_quotes  => 0,
      allow_loose_escapes => 0,
@@ -794,6 +813,17 @@
 This will return a reference to a list of C<getline_hr ($io)> results.
 In this call, C<keep_meta_info> is disabled.
 
+=head2 print_hr
+
+ $csv->print_hr ($io, $ref);
+
+Provides an easy way to print a C<$ref> as fetched with L<getline_hr>
+provided the column names are set with L<column_names>.
+
+It is just a wrapper method with basic parameter checks over
+
+ $csv->print ($io, [ map { $ref->{$_} } $csv->column_names ]);
+
 =head2 column_names
 
 Set the keys that will be used in the C<getline_hr ()> calls. If no keys
@@ -976,7 +1006,7 @@
  $error_str    = "" . $csv->error_diag ();
  ($cde, $str, $pos) = $csv->error_diag ();
 
-If (and only if) an error occured, this function returns the diagnostics
+If (and only if) an error occurred, this function returns the diagnostics
 of that error.
 
 If called in void context, it will print the internal error code and the
@@ -995,7 +1025,7 @@
 scalar, a-la $!. It will contain the error code in numeric context, and
 the diagnostics message in string context.
 
-Depending on the used worker module, returned diagnostics is diffferent.
+Depending on the used worker module, returned diagnostics is different.
 
 Text::CSV_XS parses csv strings by dividing one character while Text::CSV_PP
 by using the regular expressions. That difference makes the different cause
@@ -1042,10 +1072,10 @@
 
 =head1 DIAGNOSTICS
 
-If an error occured, $csv->error_diag () can be used to get more information
+If an error occurred, $csv->error_diag () can be used to get more information
 on the cause of the failure. Note that for speed reasons, the internal value
 is never cleared on success, so using the value returned by error_diag () in
-normal cases - when no error occured - may cause unexpected results.
+normal cases - when no error occurred - may cause unexpected results.
 
 This function changes depending on the used module (XS or PurePerl).
 
@@ -1069,7 +1099,7 @@
 
 The required Text::CSV_XS version is I<0.41> in Text::CSV version 1.03.
 
-If you set an enviornment variable C<PERL_TEXT_CSV>, The calling action will 
be changed.
+If you set an environment variable C<PERL_TEXT_CSV>, The calling action will 
be changed.
 
 =over
 
@@ -1162,17 +1192,17 @@
 Text::CSV
 
 Copyright (C) 1997 Alan Citterman. All rights reserved.
-Copyright (C) 2007-2009 Makamaka Hannyaharamitu.
+Copyright (C) 2007-2015 Makamaka Hannyaharamitu.
 
 
 Text::CSV_PP:
 
-Copyright (C) 2005-2013 Makamaka Hannyaharamitu.
+Copyright (C) 2005-2015 Makamaka Hannyaharamitu.
 
 
 Text:CSV_XS:
 
-Copyright (C) 2007-2013 H.Merijn Brand for PROCURA B.V.
+Copyright (C) 2007-2015 H.Merijn Brand for PROCURA B.V.
 Copyright (C) 1998-2001 Jochen Wiedmann. All rights reserved.
 Portions Copyright (C) 1997 Alan Citterman. All rights reserved.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/lib/Text/CSV_PP.pm 
new/Text-CSV-1.33/lib/Text/CSV_PP.pm
--- old/Text-CSV-1.32/lib/Text/CSV_PP.pm        2013-06-13 07:06:01.000000000 
+0200
+++ new/Text-CSV-1.33/lib/Text/CSV_PP.pm        2015-03-03 18:13:23.000000000 
+0100
@@ -11,7 +11,7 @@
 use vars qw($VERSION);
 use Carp ();
 
-$VERSION = '1.31';
+$VERSION = '1.33';
 
 sub PV  { 0 }
 sub IV  { 1 }
@@ -93,6 +93,7 @@
     quote_null          => 1,
     quote_binary        => 1,
     diag_verbose        => 0,
+    decode_utf8         => 1,
 
     _EOF                => 0,
     _RECNO              => 0,
@@ -354,9 +355,9 @@
 
     return 0 if(!defined $line);
 
-    my ($binary, $quot, $sep, $esc, $types, $keep_meta_info, 
$allow_whitespace, $eol, $blank_is_undef, $empty_is_undef, $unquot_esc)
+    my ($binary, $quot, $sep, $esc, $types, $keep_meta_info, 
$allow_whitespace, $eol, $blank_is_undef, $empty_is_undef, $unquot_esc, 
$decode_utf8)
          = @{$self}{
-            qw/binary quote_char sep_char escape_char types keep_meta_info 
allow_whitespace eol blank_is_undef empty_is_undef allow_unquoted_escape/
+            qw/binary quote_char sep_char escape_char types keep_meta_info 
allow_whitespace eol blank_is_undef empty_is_undef allow_unquoted_escape 
decode_utf8/
            };
 
     $sep  = ',' unless (defined $sep);
@@ -409,7 +410,7 @@
 
     my $pos = 0;
 
-    my $utf8 = 1 if utf8::is_utf8( $line ); # if UTF8 marked, flag on.
+    my $utf8 = 1 if $decode_utf8 and utf8::is_utf8( $line ); # if decode_utf8 
is true(default) and UTF8 marked, flag on.
 
     for my $col ( $line =~ /$re_split/g ) {
 
@@ -548,7 +549,7 @@
         }
 
         utf8::encode($col) if $utf8;
-        if ( defined $col && _is_valid_utf8($col) ) {
+        if ( $decode_utf8 && defined $col && _is_valid_utf8($col) ) {
             utf8::decode($col);
         }
 
@@ -566,6 +567,25 @@
     if ($palatable) {
         $self->{_ERROR_INPUT} = undef;
         $self->{_FIELDS}      = \@part;
+
+        if ( $self->{_BOUND_COLUMNS} ) {
+            my @vals  = @part;
+            my ( $max, $count ) = ( scalar @vals, 0 );
+
+            if ( @{ $self->{_BOUND_COLUMNS} } < $max ) {
+                $self->_set_error_diag(3006);
+                return;
+            }
+
+            for ( my $i = 0; $i < $max; $i++ ) {
+                my $bind = $self->{_BOUND_COLUMNS}->[ $i ];
+                if ( Scalar::Util::readonly( $$bind ) ) {
+                    $self->_set_error_diag(3008);
+                    return;
+                }
+                $$bind = $vals[ $i ];
+            }
+        }
     }
 
     $self->{_FFLAGS} = $keep_meta_info ? $meta_flag : [];
@@ -635,7 +655,7 @@
     qr/$ws*
        (
         \Q$quot\E
-            [^\Q$quot$esc\E]*(?:\Q$esc\E[\Q$quot$esc$sep\E0][^\Q$quot$esc\E]*)*
+            [^\Q$quot$esc\E]*(?:\Q$esc\E[\Q$quot\E][^\Q$quot$esc\E]*)*
         \Q$quot\E
         | # or
         [^\Q$sep\E]*?
@@ -676,7 +696,7 @@
 
     require IO::Handle;
 
-    $self->{_EOF} = eof($io) ? 1 : '';
+    $self->{_EOF} = $io->eof ? 1 : '';
 
     my $quot = $self->{quote_char};
     my $sep  = $self->{sep_char};
@@ -724,7 +744,7 @@
                 /x ? 0 : 1;
             }
 
-            if ( $is_continued and !eof($io) ) {
+            if ( $is_continued and !$io->eof) {
                 $line .= $io->getline();
                 goto LOOP;
             }
@@ -735,38 +755,13 @@
 
     $self->_parse($line);
 
-    return $self->_return_getline_result();
-}
-
-
-sub _return_getline_result {
-
     if ( eof ) {
-        $_[0]->{_AUTO_DETECT_CR} = 0;
-    }
-
-    return unless $_[0]->{_STATUS};
-
-    return [ $_[0]->_fields() ] unless $_[0]->{_BOUND_COLUMNS};
-
-    my @vals  = $_[0]->_fields();
-    my ( $max, $count ) = ( scalar @vals, 0 );
-
-    if ( @{ $_[0]->{_BOUND_COLUMNS} } < $max ) {
-            $_[0]->_set_error_diag(3006);
-            return;
+        $self->{_AUTO_DETECT_CR} = 0;
     }
 
-    for ( my $i = 0; $i < $max; $i++ ) {
-        my $bind = $_[0]->{_BOUND_COLUMNS}->[ $i ];
-        if ( Scalar::Util::readonly( $$bind ) ) {
-            $_[0]->_set_error_diag(3008);
-            return;
-        }
-        $$bind = $vals[ $i ];
-    }
+    return unless $self->{_STATUS};
 
-    return [];
+    return $self->{_BOUND_COLUMNS} ? [] : [ $self->_fields() ];
 }
 
################################################################################
 # getline_all
@@ -786,7 +781,7 @@
 
     while ( my $row = $self->getline($io) ) {
         next if $offset && $offset-- > 0;               # skip
-        last if defined $len && !$tail && $n >= $len;   # exceedes limit size
+        last if defined $len && !$tail && $n >= $len;   # exceeds limit size
         push @list, $row;
         ++$n;
         if ( $tail && $n > $tail ) {
@@ -933,7 +928,7 @@
 }
 
################################################################################
 # _check_type
-#  take an arg as scalar referrence.
+#  take an arg as scalar reference.
 #  if not numeric, make the value 0. otherwise INTEGERized.
 
################################################################################
 sub _check_type {
@@ -992,6 +987,15 @@
     $self->{sep_char};
 }
 
+sub decode_utf8 {
+    my $self = shift;
+    if ( @_ ) {
+        $self->{decode_utf8} = $_[0];
+        my $ec = _check_sanity( $self );
+        $ec and Carp::croak( $self->SetDiag( $ec ) );
+    }
+    $self->{decode_utf8};
+}
 
 sub quote_char {
     my $self = shift;
@@ -1269,7 +1273,7 @@
 
  (1, undef, undef, " ", 2)
 
-Note that this only effects fields that are I<realy> empty, not fields
+Note that this only effects fields that are I<really> empty, not fields
 that are empty after stripping allowed whitespace. YMMV.
 
 =item quote_char
@@ -1613,6 +1617,17 @@
 
 C<column_names ()> croaks on invalid arguments.
 
+=head2 print_hr
+
+ $csv->print_hr ($io, $ref);
+
+Provides an easy way to print a C<$ref> as fetched with L<getline_hr>
+provided the column names are set with L<column_names>.
+
+It is just a wrapper method with basic parameter checks over
+
+ $csv->print ($io, [ map { $ref->{$_} } $csv->column_names ]);
+
 =head2 bind_columns
 
 Takes a list of references to scalars to store the fields fetched
@@ -1755,7 +1770,7 @@
  $error_str    = "" . $csv->error_diag ();
  ($cde, $str, $pos) = $csv->error_diag ();
 
-If (and only if) an error occured, this function returns the diagnostics
+If (and only if) an error occurred, this function returns the diagnostics
 of that error.
 
 If called in void context, it will print the internal error code and the
@@ -1783,10 +1798,10 @@
 
 =head1 DIAGNOSTICS
 
-If an error occured, $csv->error_diag () can be used to get more information
+If an error occurred, $csv->error_diag () can be used to get more information
 on the cause of the failure. Note that for speed reasons, the internal value
 is never cleared on success, so using the value returned by error_diag () in
-normal cases - when no error occured - may cause unexpected results.
+normal cases - when no error occurred - may cause unexpected results.
 
 Note: CSV_PP's diagnostics is different from CSV_XS's:
 
@@ -1875,7 +1890,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright 2005-2013 by Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
+Copyright 2005-2015 by Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt>
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/12_acc.t new/Text-CSV-1.33/t/12_acc.t
--- old/Text-CSV-1.32/t/12_acc.t        2013-06-13 07:02:23.000000000 +0200
+++ new/Text-CSV-1.33/t/12_acc.t        2015-03-03 18:13:23.000000000 +0100
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;       # use warnings core since 5.6
 
-use Test::More tests => 133;
+use Test::More tests => 135; # XS's t/12_acc.t + 2 (for decode_utf8)
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
@@ -34,6 +34,7 @@
 is ($csv->quote_null,                  1,              "quote_null");
 is ($csv->quote_binary,                        1,              "quote_binary");
 is ($csv->record_number,               0,              "record_number");
+is ($csv->decode_utf8,                 1,              "decode_utf8");
 
 is ($csv->binary (1),                  1,              "binary (1)");
 my @fld = ( 'txt =, "Hi!"', "Yes", "", 2, undef, "1.09", "\r", undef );
@@ -79,6 +80,7 @@
 is ($csv->quote_space (0),             0,              "quote_space (0)");
 is ($csv->quote_null (0),              0,              "quote_null (0)");
 is ($csv->quote_binary (0),            0,              "quote_binary (0)");
+is ($csv->decode_utf8 (0),             0,              "decode_utf8 (0)");
 
 # Funny settings, all three translate to \0 internally
 ok ($csv = Text::CSV->new ({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/51_utf8.t 
new/Text-CSV-1.33/t/51_utf8.t
--- old/Text-CSV-1.32/t/51_utf8.t       2013-06-10 17:12:22.000000000 +0200
+++ new/Text-CSV-1.33/t/51_utf8.t       2015-03-03 18:13:23.000000000 +0100
@@ -43,20 +43,19 @@
        [ "bytes up :encoding(UTF-8)", ":encoding(UTF-8)", $bytes_up,  "utf8",  
 "no warn", ],
        );
 
-    plan tests => 7 + 6 * @tests;
+    plan tests => 11 + 6 * @tests;
     }
 
 BEGIN {
-    $ENV{PERL_TEXT_CSV} = 0;
-    require_ok "Text::CSV";
-    plan skip_all => "Cannot load Text::CSV" if $@;
+    require_ok "Text::CSV_PP";
+    plan skip_all => "Cannot load Text::CSV_PP" if $@;
     require "t/util.pl";
     }
 
 sub hexify { join " ", map { sprintf "%02x", $_ } unpack "C*", @_ }
 sub warned { length ($_[0]) ? "warn" : "no warn" }
 
-my $csv = Text::CSV->new ({ auto_diag => 1, binary => 1 });
+my $csv = Text::CSV_PP->new ({ auto_diag => 1, binary => 1 });
 
 for (@tests) {
     my ($test, $perlio, $data, $enc, $expect_w) = @$_;
@@ -96,26 +95,42 @@
     }
 
 # Test automatic upgrades for valid UTF-8
-{   my $data = join "\n" => (
-       "1,aap,3",              # No diac
-       "1,a\x{e1}p,3",         # a_ACUTE in ISO-8859-1
-       "1,a\x{c4}\x{83}p,3",   # a_BREVE in UTF-8
+{   my $blob = pack "C*", 0..255; $blob =~ tr/",//d;
+    # perl-5.10.x has buggy SvCUR () on blob
+    $] >= 5.010000 && $] <= 5.012001 and $blob =~ tr/\0//d;
+    my @data = (
+       qq[1,aap,3],            # No diac
+       qq[1,a\x{e1}p,3],       # a_ACUTE in ISO-8859-1
+       qq[1,a\x{c4}\x{83}p,3], # a_BREVE in UTF-8
+       qq[1,"$blob",3],        # Binary shit
        ) x 2;
-    my @expect = ("aap", "a\341p", "a\x{0103}p") x 2;
+    my $data = join "\n" => @data;
+    my @expect = ("aap", "a\341p", "a\x{0103}p", $blob) x 2;
 
-    my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1 });
+    my $csv = Text::CSV_PP->new ({ binary => 1, auto_diag => 1 });
 
     foreach my $bc (undef, 3) {
-       my @data;
+       my @read;
+
+       # Using getline ()
        open my $fh, "<", \$data;
        $bc and $csv->bind_columns (\my ($f1, $f2, $f3));
        is (scalar $csv->bind_columns, $bc, "Columns_bound?");
        while (my $row = $csv->getline ($fh)) {
-           push @data, $bc ? $f2 : $row->[1];
+           push @read, $bc ? $f2 : $row->[1];
            }
        close $fh;
-       is_deeply (\@data, \@expect, "Set and reset UTF-8 ".($bc?"no 
bind":"bind_columns"));
-       is_deeply ([ map { utf8::is_utf8 ($_) } @data ],
-           [ "", "", 1, "", "", 1 ], "UTF8 flags");
+       is_deeply (\@read, \@expect, "Set and reset UTF-8 ".($bc?"no 
bind":"bind_columns"));
+       is_deeply ([ map { utf8::is_utf8 ($_) } @read ],
+           [ "", "", 1, "", "", "", 1, "" ], "UTF8 flags");
+
+       # Using parse ()
+       @read = map {
+           $csv->parse ($_);
+           $bc ? $f2 : ($csv->fields)[1];
+           } @data;
+       is_deeply (\@read, \@expect, "Set and reset UTF-8 ".($bc?"no 
bind":"bind_columns"));
+       is_deeply ([ map { utf8::is_utf8 ($_) } @read ],
+           [ "", "", 1, "", "", "", 1, "" ], "UTF8 flags");
        }
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/70_rt.t new/Text-CSV-1.33/t/70_rt.t
--- old/Text-CSV-1.32/t/70_rt.t 2013-06-13 06:43:01.000000000 +0200
+++ new/Text-CSV-1.33/t/70_rt.t 2015-03-03 18:13:23.000000000 +0100
@@ -225,8 +225,9 @@
     ok ($csv = Text::CSV->new ({
        sep_char => "\t",
        }), "RT-$rt: $desc{$rt}");
-    open  FH, "<$csv_file";
-    while (my $row = $csv->getline (*FH)) {
+    my $FH;
+    open  $FH, "<$csv_file";
+    while (my $row = $csv->getline ($FH)) {
        ok ($row, "getline $.");
        my @row = @$row;
        is ($#row, 2, "Got 3 fields");
@@ -239,8 +240,8 @@
        sep_char         => "\t",
        allow_whitespace => 1,
        }), "RT-$rt: $desc{$rt}");
-    open  FH, "<$csv_file";
-    while (my $row = $csv->getline (*FH)) {
+    open  $FH, "<$csv_file";
+    while (my $row = $csv->getline ($FH)) {
        ok ($row, "getline $.");
        my @row = @$row;
        is ($#row, 2, "Got 3 fields");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/71_pp.t new/Text-CSV-1.33/t/71_pp.t
--- old/Text-CSV-1.32/t/71_pp.t 2013-06-13 08:29:31.000000000 +0200
+++ new/Text-CSV-1.33/t/71_pp.t 2015-03-03 18:13:23.000000000 +0100
@@ -5,7 +5,7 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 99;
+use Test::More tests => 103;
 
 
 BEGIN { $ENV{PERL_TEXT_CSV} = $ARGV[0] || 0; }
@@ -351,3 +351,29 @@
 ok( $csv->parse(q{1,2\,4,3}) );
 is_deeply ([ $csv->fields ], [ 1, "2,4", 3 ], "escaped sep in quoted field");
 }
+
+{ # https://github.com/makamaka/Text-CSV/pull/3
+
+    {
+        package FakeFileHandleForEOF;
+
+        sub new { return bless { line => "foo,bar,baz\n" }, shift }
+
+        sub getline {
+            my $self = shift;
+            return delete $self->{line};
+        }
+
+        sub eof {
+            my $self = shift;
+            return not exists $self->{line};
+        }
+    }
+
+    my $csv = Text::CSV->new({binary => 1});
+    my $fh  = FakeFileHandleForEOF->new;
+    ok(!$fh->eof);
+    eval { is_deeply( $csv->getline($fh), [qw[ foo bar baz ]]) };
+    is($@, '', "no exception thrown");
+    ok($fh->eof);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/77_getall.t 
new/Text-CSV-1.33/t/77_getall.t
--- old/Text-CSV-1.32/t/77_getall.t     2013-06-07 08:35:47.000000000 +0200
+++ new/Text-CSV-1.33/t/77_getall.t     2015-03-03 18:13:23.000000000 +0100
@@ -3,7 +3,7 @@
 use strict;
 $^W = 1;
 
-use Test::More tests => 29;
+use Test::More tests => 61;
 
 BEGIN {
     $ENV{PERL_TEXT_CSV} = 0;
@@ -14,19 +14,15 @@
 
 $| = 1;
 
-my @list = (
+
+my @testlist = (
     [ 1, "a", "\x01", "A" ],
     [ 2, "b", "\x02", "B" ],
     [ 3, "c", "\x03", "C" ],
     [ 4, "d", "\x04", "D" ],
     );
 
-{   ok (my $csv = Text::CSV->new ({ binary => 1, eol => "\n" }), "csv out");
-    open  FH, ">_77test.csv" or die "_77test.csv: $!";
-    ok ($csv->print (*FH, $_), "write $_->[0]") for @list;
-    close FH;
-    }
-
+my @list;
 sub do_tests
 {
     my $sub = shift;
@@ -43,28 +39,45 @@
     $sub->([@list[1..3]], -3,  3);
     } # do_tests
 
-{   ok (my $csv = Text::CSV->new ({ binary => 1 }), "csv in");
+foreach my $eol ("\n", "\r") {
 
-    do_tests (sub {
-       my ($expect, @args) = @_;
-       open  FH, "<_77test.csv" or die "_77test.csv: $!";
-       my $s_args = join ", " => @args;
-       is_deeply ($csv->getline_all (*FH, @args), $expect, "getline_all 
($s_args)");
-       close FH;
-       });
-    }
+    @list = @testlist;
 
-{   ok (my $csv = Text::CSV->new ({ binary => 1 }), "csv in");
-    ok ($csv->column_names (my @cn = qw( foo bar bin baz )));
-    @list = map { my %h; @h{@cn} = @$_; \%h } @list;
-
-    do_tests (sub {
-       my ($expect, @args) = @_;
-       open  FH, "<_77test.csv" or die "_77test.csv: $!";
-       my $s_args = join ", " => @args;
-       is_deeply ($csv->getline_hr_all (*FH, @args), $expect, "getline_hr_all 
($s_args)");
-       close FH;
-       });
-    }
+    {   ok (my $csv = Text::CSV->new ({ binary => 1, eol => $eol }), "csv out 
EOL "._readable ($eol));
+       open my $fh, ">", "_77test.csv" or die "_77test.csv: $!";
+       ok ($csv->print ($fh, $_), "write $_->[0]") for @list;
+       close $fh;
+       }
+
+    {   ok (my $csv = Text::CSV->new ({ binary => 1 }), "csv in");
+
+       do_tests (sub {
+           my ($expect, @args) = @_;
+           open my $fh, "<", "_77test.csv" or die "_77test.csv: $!";
+           my $s_args = join ", " => @args;
+           is_deeply ($csv->getline_all ($fh, @args), $expect, "getline_all 
($s_args)");
+           close $fh;
+           });
+       }
+
+    {   ok (my $csv = Text::CSV->new ({ binary => 1 }), "csv in");
+       ok ($csv->column_names (my @cn = qw( foo bar bin baz )), "Set column 
names");
+       @list = map { my %h; @h{@cn} = @$_; \%h } @list;
+
+       do_tests (sub {
+           my ($expect, @args) = @_;
+           open my $fh, "<", "_77test.csv" or die "_77test.csv: $!";
+           my $s_args = join ", " => @args;
+           is_deeply ($csv->getline_hr_all ($fh, @args), $expect, 
"getline_hr_all ($s_args)");
+           close $fh;
+           });
+       }
+
+    {   ok (my $csv = Text::CSV->new ({ binary => 1 }), "csv in");
+       open my $fh, "<", "_77test.csv" or die "_77test.csv: $!";
+       eval { my $row = $csv->getline_hr_all ($fh); };
+       is ($csv->error_diag () + 0, 3002, "Use _hr before colnames ()");
+       }
 
-unlink "_77test.csv";
+    unlink "_77test.csv";
+    }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/81_subclass.t 
new/Text-CSV-1.33/t/81_subclass.t
--- old/Text-CSV-1.32/t/81_subclass.t   2013-06-07 08:35:47.000000000 +0200
+++ new/Text-CSV-1.33/t/81_subclass.t   2015-03-03 18:13:23.000000000 +0100
@@ -10,7 +10,6 @@
 
 use strict;
 $^W = 1;
-$|  = 1;
 
 use base "Text::CSV";
 
@@ -19,7 +18,7 @@
 ok (1, "Subclassed");
 
 my $csvs = Text::CSV::Subclass->new ();
-is ("" . $csvs->error_diag (), "",             "Last failure for new () - OK");
+is ("" . $csvs->error_diag (), "", "Last failure for new () - OK");
 
 my $sc_csv;
 eval { $sc_csv = Text::CSV::Subclass->new ({ ecs_char => ":" }); };
@@ -27,6 +26,6 @@
 is ($@, "", "error");
 
 is ("" . Text::CSV::Subclass->error_diag (),
-    "INI - Unknown attribute 'ecs_char'",      "Last failure for new () - 
FAIL");
+    "INI - Unknown attribute 'ecs_char'", "Last failure for new () - FAIL");
 
 1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/fields_containing_0.t 
new/Text-CSV-1.33/t/fields_containing_0.t
--- old/Text-CSV-1.32/t/fields_containing_0.t   1970-01-01 01:00:00.000000000 
+0100
+++ new/Text-CSV-1.33/t/fields_containing_0.t   2015-03-03 18:13:23.000000000 
+0100
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+
+=head1 DESCRIPTION
+
+This is a test program that succeeds with Text::CSV_PP and fails with
+Text::CSV_XS. The Text::CSV_XS behaviour is the correct one.
+
+=head1 CREDITS AND LICENSE
+
+The sample data (now anonymised) and a test program were contributed by
+blue_sky on Freenode’s
+#perl channel as part of a problem report with Text::CSV_PP based on the
+Text::CSV documentation. License is open source and compatible with the license
+of Text::CSV.
+
+Converted into a test program by Shlomi Fish ( L<http://www.shlomifish.org/> )
+, while disclaiming all explicit or implicit copyright ownership on the
+modifications.
+
+==head1 MODIFICATION
+
+modified by makamaka for old perl.
+
+=cut
+
+#use warnings;
+$^W = 1;
+use strict;
+
+use Test::More tests => 4;
+
+my $FALSE = 0;
+# my $USE_XS = $ENV{'USE_TEXT_CSV_XS'};
+my $USE_XS = $FALSE;
+
+use Text::CSV_PP;
+use Data::Dumper qw(Dumper);
+
+END { unlink '_fc0_test.csv'; }
+
+if ($USE_XS)
+{
+    require Text::CSV_XS;
+}
+
+{
+    my $csv_text = <<'EOF';
+"DIVISION CODE", "DIVISION DESCRIPTION", "CUSTOMER CODE", "CUSTOMER NAME", 
"SHORT NAME", "ADDRESS LINE 1", "ADDRESS LINE 2", "ADDRESS LINE 3", "TOWN", 
"COUNTY", "POST CODE", "COUNTRY", "GRID REF", "TELEPHONE", "AGENT CODE", "YEAR 
TO DATE SALES"
+"1", "UK", "Lambda", "Gambda Noo", "Foo", "Quad", "Rectum", "", "Eingoon", 
"Land", "Simplex", "", "", "099 999", "", 0.00
+EOF
+
+#    open my $IF, "<", \$csv_text;
+    my $IF;
+    open  $IF, ">_fc0_test.csv" or die "_fc0_test.csv: $!";
+    print $IF $csv_text;
+    close $IF;
+
+    open  $IF, "<_fc0_test.csv" or die "_fc0_test.csv: $!";
+
+    my $csv = ($USE_XS ? "Text::CSV_XS" : "Text::CSV_PP")->new({
+            allow_whitespace    => 1,
+            allow_loose_escapes => 1,
+        }) or die "Cannot use CSV: ".Text::CSV->error_diag();
+
+    $csv->column_names( $csv->getline($IF) );
+
+    {
+        my $first_line = $csv->getline_hr($IF);
+
+        # TEST
+        is ($first_line->{'POST CODE'}, 'Simplex',
+            "First line POST CODE"
+        );
+
+        # TEST
+        is ($first_line->{'COUNTRY'}, '',
+            "First line COUNTRY",
+        );
+
+        # TEST
+        is ($first_line->{'GRID REF'}, '',
+            "First line GRID REF",
+        );
+
+        # TEST
+        is ($first_line->{'TELEPHONE'}, '099 999',
+            "First line TELEPHONE",
+        );
+    }
+    close($IF);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV-1.32/t/rt99774.t 
new/Text-CSV-1.33/t/rt99774.t
--- old/Text-CSV-1.32/t/rt99774.t       1970-01-01 01:00:00.000000000 +0100
+++ new/Text-CSV-1.33/t/rt99774.t       2015-03-03 18:13:23.000000000 +0100
@@ -0,0 +1,42 @@
+
+$^W = 1;
+use strict;
+
+use Test::More tests => 8;
+
+
+BEGIN {
+    $ENV{PERL_TEXT_CSV} = 0;
+    require_ok "Text::CSV";
+    plan skip_all => "Cannot load Text::CSV" if $@;
+    require "t/util.pl";
+    }
+
+my $csv = Text::CSV->new ( { binary => 1, sep_char => ';', allow_whitespace => 
1, quote_char => '"' } );
+
+# https://rt.cpan.org/Public/Bug/Display.html?id=99774
+
+while ( my $line = <DATA> ) {
+    my $text = $line;
+    chomp($text); $text =~ s/"//g;
+    my $expect = [ split/;/, $text ];
+
+    $csv->parse($line);
+    is_deeply( [$csv->fields], $expect, $line );
+}
+
+# https://rt.cpan.org/Public/Bug/Display.html?id=92509
+
+for my $allow_whitespace ( 0, 1 ) {
+    $csv = Text::CSV_PP->new ( { allow_whitespace => $allow_whitespace } );
+    $csv->parse(q{"value1","0","value3"});
+    is_deeply( [$csv->fields], ["value1","0","value3"], 'allow_whitespace:' . 
$allow_whitespace );
+}
+
+
+__DATA__
+"data_quality_id";"language_version_id";"name"
+"0";"2";"0%"
+"10";"2";"33%"
+"20";"2";"66%"
+"30";"2";"100%"


Reply via email to