r48853 - in /branches/upstream/libspreadsheet-read-perl/current: Changes META.yml Read.pm t/24_csv.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Dec 16 04:30:37 UTC 2009


Author: jawnsy-guest
Date: Wed Dec 16 04:30:32 2009
New Revision: 48853

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48853
Log:
[svn-upgrade] Integrating new upstream version, libspreadsheet-read-perl (0.38)

Modified:
    branches/upstream/libspreadsheet-read-perl/current/Changes
    branches/upstream/libspreadsheet-read-perl/current/META.yml
    branches/upstream/libspreadsheet-read-perl/current/Read.pm
    branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t

Modified: branches/upstream/libspreadsheet-read-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-read-perl/current/Changes?rev=48853&op=diff
==============================================================================
--- branches/upstream/libspreadsheet-read-perl/current/Changes (original)
+++ branches/upstream/libspreadsheet-read-perl/current/Changes Wed Dec 16 04:30:32 2009
@@ -1,6 +1,11 @@
 Revision history for Spreadsheet::Read
 
-0.37	Thu 09 Nov 2009
+0.38	Tue 15 Dec 2009
+
+    - Add row () and cellrow ()
+    - Updated META.yml to meet most recent specs (optional_features = map)
+
+0.37	Mon 09 Nov 2009
 
     - IO streams improvements
     - MANIFEST fix

Modified: branches/upstream/libspreadsheet-read-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-read-perl/current/META.yml?rev=48853&op=diff
==============================================================================
--- branches/upstream/libspreadsheet-read-perl/current/META.yml (original)
+++ branches/upstream/libspreadsheet-read-perl/current/META.yml Wed Dec 16 04:30:32 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.1
 name:                   Read
-version:                0.37
+version:                0.38
 abstract:               Meta-Wrapper for reading spreadsheet data
 license:                perl
 author:                 
@@ -10,7 +10,7 @@
 provides:
   Spreadsheet::Read:
     file:               Read.pm
-    version:            0.37
+    version:            0.38
 requires:                       
   perl:                 5.006
   Exporter:             0
@@ -34,31 +34,31 @@
   version:              1.4
   url:                  http://module-build.sourceforge.net/META-spec-v1.4.html
 optional_features:
-- opt_csv:
+  opt_csv:
     description:        Provides parsing of CSV streams
     requires:
       Text::CSV_XS:                        0.69
     recommends:
-      Text::CSV:                           1.15
-      Text::CSV_PP:                        1.23
-      Text::CSV_XS:                        0.69
-- opt_excel:
+      Text::CSV:                           1.16
+      Text::CSV_PP:                        1.24
+      Text::CSV_XS:                        0.70
+  opt_excel:
     description:        Provides parsing of Microsoft Excel files
     requires:
       Spreadsheet::ParseExcel:             0.26
       Spreadsheet::ParseExcel::FmtDefault: 0
     recommends:
-      Spreadsheet::ParseExcel:             0.55
-- opt_excelx:
+      Spreadsheet::ParseExcel:             0.56
+  opt_excelx:
     description:        Provides parsing of Microsoft Excel 2007 files
     requires:
       Spreadsheet::XLSX:                   0.12
       Spreadsheet::XLSX::Fmt2007:          0
-- opt_oo:
+  opt_oo:
     description:        Provides parsing of OpenOffice spreadsheets
     requires:
       Spreadsheet::ReadSXC:                0.2
-- opt_tools:
+  opt_tools:
     description:        Spreadsheet tools
     recommends:
       Tk:                                  0

Modified: branches/upstream/libspreadsheet-read-perl/current/Read.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-read-perl/current/Read.pm?rev=48853&op=diff
==============================================================================
--- branches/upstream/libspreadsheet-read-perl/current/Read.pm (original)
+++ branches/upstream/libspreadsheet-read-perl/current/Read.pm Wed Dec 16 04:30:32 2009
@@ -23,14 +23,14 @@
 use strict;
 use warnings;
 
-our $VERSION = "0.37";
+our $VERSION = "0.38";
 sub  Version { $VERSION }
 
 use Carp;
 use Exporter;
 our @ISA       = qw( Exporter );
 our @EXPORT    = qw( ReadData cell2cr cr2cell );
-our @EXPORT_OK = qw( parses rows );
+our @EXPORT_OK = qw( parses rows cellrow row );
 
 use File::Temp   qw( );
 use Data::Dumper;
@@ -126,6 +126,29 @@
 	}
     ($c, $r);
     } # cell2cr
+
+# my @row = cellrow ($ss->[1], 1);
+sub cellrow
+{
+    my $sheet = shift or return;
+    ref     $sheet eq "HASH" && exists  $sheet->{cell}   or return;
+    exists  $sheet->{maxcol} && exists  $sheet->{maxrow} or return;
+    my $row   = shift or return;
+    $row > 0 && $row <= $sheet->{maxrow} or return;
+    my $s = $sheet->{cell};
+    map { $s->[$_][$row] } 1..$sheet->{maxcol};
+    } # cellrow
+
+# my @row = row ($ss->[1], 1);
+sub row
+{
+    my $sheet = shift or return;
+    ref     $sheet eq "HASH" && exists  $sheet->{cell}   or return;
+    exists  $sheet->{maxcol} && exists  $sheet->{maxrow} or return;
+    my $row   = shift or return;
+    $row > 0 && $row <= $sheet->{maxrow} or return;
+    map { $sheet->{cr2cell ($_, $row)} } 1..$sheet->{maxcol};
+    } # row
 
 # Convert {cell}'s [column][row] to a [row][column] list
 # my @rows = rows ($ss->[1]);
@@ -820,6 +843,28 @@
   my ($col, $row) = cell2cr ("D14"); # returns ( 4, 14)
   my ($col, $row) = cell2cr ("AB4"); # returns (28,  4)
 
+=item my @row = row ($ref, $row)
+
+=item my @row = Spreadsheet::Read::row ($ss->[1], 3)
+
+Get full row of formatted values (like C<< $ss->{A3} .. $ss->{G3} >>)
+
+Note that the indexes in the returned list are 0-based.
+
+C<row ()> is not imported by default, so either specify it in the
+use argument list, or call it fully qualified.
+
+=item my @row = cellrow ($ref, $row)
+
+=item my @row = Spreadsheet::Read::cellrow ($ss->[1], 3)
+
+Get full row of unformatted values (like C<< $ss->{cell}[1][3] .. $ss->{cell}[7][3] >>)
+
+Note that the indexes in the returned list are 0-based.
+
+C<cellrow ()> is not imported by default, so either specify it in the
+use argument list, or call it fully qualified.
+
 =item my @rows = rows ($ref)
 
 =item my @rows = Spreadsheet::Read::rows ($ss->[1])

Modified: branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t?rev=48853&op=diff
==============================================================================
--- branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t (original)
+++ branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t Wed Dec 16 04:30:32 2009
@@ -3,11 +3,11 @@
 use strict;
 use warnings;
 
-my     $tests = 116;
+my     $tests = 118;
 use     Test::More;
 require Test::NoWarnings;
 
-use     Spreadsheet::Read;
+use     Spreadsheet::Read qw( ReadData cell2cr row cellrow );
 my $parser = Spreadsheet::Read::parses ("csv") or
     plan skip_all => "No CSV parser found";
 
@@ -52,6 +52,10 @@
     is ($csv->[1]{$cell},		"",   	"Formatted   cell $cell");
     }
 
+my @row = ("A3", "", "C3", "D3", (undef) x 15);
+is_deeply ([ row     ($csv->[1], 3) ], \@row, "Formatted   row 3");
+is_deeply ([ cellrow ($csv->[1], 3) ], \@row, "Unformatted row 3");
+
 ok ($csv = ReadDataCSV ("files/test_m.txt"),	"Read/Parse M\$ csv file");
 
 ok (1, "Defined fields");




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