Hello community,

here is the log from the commit of package perl-Text-CSV_XS for 
openSUSE:Factory checked in at 2012-03-12 20:15:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Text-CSV_XS (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Text-CSV_XS", Maintainer is "u...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Text-CSV_XS/perl-Text-CSV_XS.changes        
2012-02-17 12:08:19.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Text-CSV_XS.new/perl-Text-CSV_XS.changes   
2012-03-12 20:15:57.000000000 +0100
@@ -1,0 +2,8 @@
+Sun Mar 11 19:20:16 UTC 2012 - co...@suse.com
+
+- updated to 0.87
+    * Extra check on utf8 output (RT#74330)                                    
                                                                                
                                           
+    * examples/csvdiff now recognizes numerically sorted CSV files             
                                                                                
                                           
+    * Document example comparing getline_hr vs bind_columns + getline          
                                                                                
                                           
+
+-------------------------------------------------------------------

Old:
----
  Text-CSV_XS-0.86.tgz

New:
----
  Text-CSV_XS-0.87.tgz

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

Other differences:
------------------
++++++ perl-Text-CSV_XS.spec ++++++
--- /var/tmp/diff_new_pack.joSisJ/_old  2012-03-12 20:15:58.000000000 +0100
+++ /var/tmp/diff_new_pack.joSisJ/_new  2012-03-12 20:15:58.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Text-CSV_XS
-Version:        0.86
+Version:        0.87
 Release:        0
 %define cpan_name Text-CSV_XS
 Summary:        comma-separated values manipulation routines

++++++ Text-CSV_XS-0.86.tgz -> Text-CSV_XS-0.87.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/CSV_XS.pm 
new/Text-CSV_XS-0.87/CSV_XS.pm
--- old/Text-CSV_XS-0.86/CSV_XS.pm      2012-01-21 12:57:01.000000000 +0100
+++ new/Text-CSV_XS-0.87/CSV_XS.pm      2012-03-08 12:22:44.000000000 +0100
@@ -27,7 +27,7 @@
 use Carp;
 
 use vars   qw( $VERSION @ISA );
-$VERSION = "0.86";
+$VERSION = "0.87";
 @ISA     = qw( DynaLoader );
 bootstrap Text::CSV_XS $VERSION;
 
@@ -1224,6 +1224,32 @@
 
 L</getline_hr> will croak if called before L</column_names>.
 
+Note that L</getline_hr> creates a hashref for every row and might be much
+slower than the combined use of L</bind_columns> and L</getline> but still
+offering the same ease of use hashref inside the loop:
+
+ my @cols = @{$csv->getline ($io)};
+ $csv->column_names (@cols);
+ while (my $row = $csv->getline_hr ($io)) {
+     print $row->{price};
+     }
+
+Could easily be rewritten to the much faster:
+
+ my @cols = @{$csv->getline ($io)};
+ my $row = {};
+ $csv->bind_columns (\@{$row}{@cols});
+ while ($csv->getline ($io)) {
+     print $row->{price};
+     }
+
+Your mileage may vary for the size of the data and the numbers of rows, but 
+with perl-5.14.2 the difference is like for a 100_000 line file with 14 rows:
+
+            Rate hashrefs getlines
+ hashrefs 1.00/s       --     -76%
+ getlines 4.15/s     313%       --
+
 =head2 getline_hr_all
 X<getline_hr_all>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/CSV_XS.xs 
new/Text-CSV_XS-0.87/CSV_XS.xs
--- old/Text-CSV_XS-0.86/CSV_XS.xs      2012-01-22 15:15:05.000000000 +0100
+++ new/Text-CSV_XS-0.87/CSV_XS.xs      2012-01-25 08:45:00.000000000 +0100
@@ -19,6 +19,7 @@
 #include "ppport.h"
 #if (PERL_BCDVERSION <= 0x5005005)
 #  define sv_utf8_upgrade(sv)  /* no-op */
+#  define is_utf8_string(s,l)  0
 #  define SvUTF8_on(sv)                /* no-op */
 #  define SvUTF8(sv)           0
 #  endif
@@ -601,7 +602,7 @@
        PUSHs ((dst));
        PUSHs (tmp);
        PUTBACK;
-       if (csv->utf8)
+       if (csv->utf8 && is_utf8_string (SvPV_nolen (tmp), 0))
            SvUTF8_on (tmp);
        result = call_sv (m_print, G_SCALAR | G_METHOD);
        SPAGAIN;
@@ -617,7 +618,7 @@
        sv_catpvn (SvRV (dst), csv->buffer, csv->used);
        result = TRUE;
        }
-    if (csv->utf8 && SvROK (dst))
+    if (csv->utf8 && SvROK (dst) && is_utf8_string (SvPV_nolen (SvRV (dst)), 
0))
        SvUTF8_on (SvRV (dst));
     csv->used = 0;
     return result;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/ChangeLog 
new/Text-CSV_XS-0.87/ChangeLog
--- old/Text-CSV_XS-0.86/ChangeLog      2012-01-22 15:49:10.000000000 +0100
+++ new/Text-CSV_XS-0.87/ChangeLog      2012-03-08 12:21:11.000000000 +0100
@@ -1,3 +1,8 @@
+0.87   - 2012-03-08, H.Merijn Brand
+    * Extra check on utf8 output (RT#74330)
+    * examples/csvdiff now recognizes numerically sorted CSV files
+    * Document example comparing getline_hr vs bind_columns + getline
+
 0.86   - 2012-01-22, H.Merijn Brand
     * Introduce quote_binary attribute
     * Update copyright to 2012
@@ -13,7 +18,7 @@
 
 0.83   - 2011-08-07, H.Merijn Brand
     * Fix spurious auto_diag warning (RT#69673)
-    * Tested with 50 versions of perl, including 1.15.1
+    * Tested with 50 versions of perl, including 5.15.1
 
 0.82   - 2011-05-01, H.Merijn Brand
     * Doc fix (RT#66905, Peter Newman)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/META.json 
new/Text-CSV_XS-0.87/META.json
--- old/Text-CSV_XS-0.86/META.json      2012-01-22 16:02:43.000000000 +0100
+++ new/Text-CSV_XS-0.87/META.json      2012-03-08 12:38:55.000000000 +0100
@@ -14,7 +14,7 @@
       },
    "distribution_type" : "module",
    "generated_by" : "Author",
-   "version" : "0.86",
+   "version" : "0.87",
    "name" : "Text-CSV_XS",
    "author" : [
       "H.Merijn Brand <h.m.br...@xs4all.nl>"
@@ -25,7 +25,7 @@
       },
    "provides" : {
       "Text::CSV_XS" : {
-         "version" : "0.86",
+         "version" : "0.87",
          "file" : "CSV_XS.pm"
          }
       },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/META.yml 
new/Text-CSV_XS-0.87/META.yml
--- old/Text-CSV_XS-0.86/META.yml       2012-01-22 16:02:43.000000000 +0100
+++ new/Text-CSV_XS-0.87/META.yml       2012-03-08 12:38:55.000000000 +0100
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                    Text-CSV_XS
-version:                 0.86
+version:                 0.87
 abstract:                Comma-Separated Values manipulation routines
 license:                 perl
 author:              
@@ -10,7 +10,7 @@
 provides:
     Text::CSV_XS:
         file:            CSV_XS.pm
-        version:         0.86
+        version:         0.87
 requires:     
     perl:                5.005
     DynaLoader:          0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/examples/csvdiff 
new/Text-CSV_XS-0.87/examples/csvdiff
--- old/Text-CSV_XS-0.86/examples/csvdiff       2009-10-04 12:40:25.000000000 
+0200
+++ new/Text-CSV_XS-0.87/examples/csvdiff       2012-03-08 12:27:38.000000000 
+0100
@@ -37,7 +37,7 @@
 my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 0 });
 
 if ($opt_h) {
-    binmode STDOUT, ":utf8";
+    binmode STDOUT, ":encoding(utf-8)";
     print <<EOH;
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
@@ -50,6 +50,7 @@
   <style type="text/css">
     .rd { background:  #ffe0e0;        }
     .gr { background:  #e0ffe0;        }
+    .hd { background:  #e0e0ff;        }
     .b0 { background:  #e0e0e0;        }
     .b1 { background:  #f0f0f0;        }
     .r  { color:       red;            }
@@ -71,21 +72,28 @@
     }
 
 my @f;
+my $opt_n = 1;
 foreach my $x (0, 1) {
     open my $fh, "<", $ARGV[$x] or die "$ARGV[$x]: $!\n";
-    while (1) { $_ = $csv->getline ($fh) or last; @$_ and push @{$f[$x]}, $_ }
+    my $n = 0;
+    while (1) {
+       my $row = $csv->getline ($fh) or last;
+       @$row and push @{$f[$x]}, $row;
+       $n++ && $row->[0] =~ m/\D/ and $opt_n = 0;
+       }
     }
 my @n   = map { $#{$f[$_]} } 0, 1;
 my @i   = (1, 1);
 my $hdr = "# csvdiff   < $ARGV[0]    > $ARGV[1]\n";
 
-$f[$_][1+$n[$_]][0] = "\xff\xff\xff\xff" for 0, 1;
+$f[$_][1+$n[$_]][0] = $opt_n ? 2147483647 : "\xff\xff\xff\xff" for 0, 1;
 
 my %cls;
    %cls = (
     "b" => 0,
     "-"        => sub { "rd" },
     "+"        => sub { "gr" },
+    "H"        => sub { "hd" },
     "<"        => sub { $cls{b} ^= 1; "b$cls{b}" },
     ">"        => sub { "b$cls{b}" },
     );
@@ -109,17 +117,39 @@
     $hdr = "";
     } # show
 
+# Skip first line of both are same: it probably is a header
+my @h0 = @{$f[0][0]};
+my @h1 = @{$f[1][0]};
+if ("@h0" eq "@h1") {
+    if ($opt_h) {
+       $i[0]--;
+       show ("H", 0);
+       }
+    shift @{$f[0]};
+    shift @{$f[1]};
+    }
+
+my $x = 0;
 while ($i[0] <= $n[0] || $i[1] <= $n[1]) {
-    $f[0][$i[0]][0] lt $f[1][$i[1]][0] and show ("-", 0), next;
-    $f[0][$i[0]][0] gt $f[1][$i[1]][0] and show ("+", 1), next;
+    my @r0 = @{$f[0][$i[0]]};
+    my @r1 = @{$f[1][$i[1]]};
+
+    if ($opt_n) {
+       $r0[0] <  $r1[0] and show ("-", 0), next;
+       $r0[0] >  $r1[0] and show ("+", 1), next;
+       }
+    else {
+       $r0[0] lt $r1[0] and show ("-", 0), next;
+       $r0[0] gt $r1[0] and show ("+", 1), next;
+       }
 
-    "@{[@{$f[0][$i[0]]}]}" eq "@{[@{$f[1][$i[1]]}]}" and
-       $i[0]++, $i[1]++, next;
+    "@r0" eq "@r1" and $i[0]++, $i[1]++, next;
 
-    foreach my $c (1 .. $#{$f[0][0]}) {
-       $f[0][$i[0]][$c] eq $f[1][$i[1]][$c] and next;
-       $f[0][$i[0]][$c] = RED   . $f[0][$i[0]][$c] . RESET;
-       $f[1][$i[1]][$c] = GREEN . $f[1][$i[1]][$c] . RESET;
+    foreach my $c (1 .. $#h0) {
+       my ($L, $R) = map { defined $_ ? $_ : "" } $r0[$c], $r1[$c];
+       $L eq $R and next;
+       $f[0][$i[0]][$c] = RED   . $L . RESET;
+       $f[1][$i[1]][$c] = GREEN . $R . RESET;
        }
 
     show ("<", 0);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Text-CSV_XS-0.86/t/70_rt.t 
new/Text-CSV_XS-0.87/t/70_rt.t
--- old/Text-CSV_XS-0.86/t/70_rt.t      2012-01-22 15:50:04.000000000 +0100
+++ new/Text-CSV_XS-0.87/t/70_rt.t      2012-01-24 22:12:01.000000000 +0100
@@ -4,7 +4,7 @@
 $^W = 1;
 
 #use Test::More "no_plan";
- use Test::More tests => 442;
+ use Test::More tests => 449;
 
 BEGIN {
     use_ok "Text::CSV_XS", ();
@@ -383,6 +383,29 @@
        }
     }
 
+SKIP: {   # http://rt.cpan.org/Ticket/Display.html?id=74220
+    $] < 5.008002 and skip "UTF8 unreliable in perl $]", 7;
+
+    $rt = "74220"; # Text::CSV_XS can be made to produce bad strings
+    my $csv = Text::CSV_XS->new ({ binary => 1 });
+
+    my $ax = chr (0xfa);
+    my $bx = "foo";
+
+    # We set the UTF-8 flag on a string with no funny characters
+    utf8::upgrade ($bx);
+    is ($bx, "foo", "no funny characters in the string");
+
+    ok (utf8::valid ($ax), "first string correct in Perl");
+    ok (utf8::valid ($bx), "second string correct in Perl");
+
+    ok ($csv->combine ($ax, $bx),      "combine ()");
+    ok (my $foo = $csv->string (),     "string ()");
+
+    ok (utf8::valid ($foo), "is combined string correct inside Perl?");
+    is ($foo, qq{\xfa,foo}, "expected result");
+    }
+
 __END__
 �24386� - \t doesn't work in _XS, works in _PP
 VIN    StockNumber     Year    Make    Model   MD      Engine  EngineSize      
Transmission    DriveTrain      Trim    BodyStyle       CityFuel        HWYFuel 
Mileage Color   InteriorColor   InternetPrice   RetailPrice     Notes   
ShortReview     Certified       NewUsed Image_URLs      Equipment
@@ -432,6 +455,7 @@
 3,4
 5,6
 7,8
+�74330� - Text::CSV_XS can be made to produce bad strings
 �x1001� - Lines starting with "0" (Ruslan Dautkhanov)
 "0","A"
 "0","A"

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to