r46975 - in /trunk/libspreadsheet-read-perl: ./ debian/ files/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Nov 10 16:59:56 UTC 2009


Author: jawnsy-guest
Date: Tue Nov 10 16:59:49 2009
New Revision: 46975

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46975
Log:
* New upstream release
* Update dependencies per upstream

Added:
    trunk/libspreadsheet-read-perl/files/empty.txt
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/files/empty.txt
    trunk/libspreadsheet-read-perl/files/test.txt
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/files/test.txt
    trunk/libspreadsheet-read-perl/files/test_m.txt
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/files/test_m.txt
    trunk/libspreadsheet-read-perl/files/test_t.txt
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/files/test_t.txt
    trunk/libspreadsheet-read-perl/files/test_x.txt
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/files/test_x.txt
    trunk/libspreadsheet-read-perl/t/23_csv.t
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/t/23_csv.t
    trunk/libspreadsheet-read-perl/t/24_csv.t
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/t/24_csv.t
    trunk/libspreadsheet-read-perl/t/36_xls.t
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/t/36_xls.t
    trunk/libspreadsheet-read-perl/t/51_sc.t
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/t/51_sc.t
    trunk/libspreadsheet-read-perl/t/60_xlsx.t
      - copied unchanged from r46973, branches/upstream/libspreadsheet-read-perl/current/t/60_xlsx.t
Removed:
    trunk/libspreadsheet-read-perl/t/60_xls.t
Modified:
    trunk/libspreadsheet-read-perl/Changes
    trunk/libspreadsheet-read-perl/MANIFEST
    trunk/libspreadsheet-read-perl/META.yml
    trunk/libspreadsheet-read-perl/Makefile.PL
    trunk/libspreadsheet-read-perl/README
    trunk/libspreadsheet-read-perl/Read.pm
    trunk/libspreadsheet-read-perl/debian/changelog
    trunk/libspreadsheet-read-perl/debian/control

Modified: trunk/libspreadsheet-read-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/Changes?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/Changes (original)
+++ trunk/libspreadsheet-read-perl/Changes Tue Nov 10 16:59:49 2009
@@ -1,4 +1,19 @@
 Revision history for Spreadsheet::Read
+
+0.37	Thu 09 Nov 2009
+
+    - IO streams improvements
+    - MANIFEST fix
+
+0.36	Thu 06 Nov 2009
+
+    - Add strip option
+    - Spreadsheet::XLSX 0.12 still does not support attributes
+    - Require Text::CSV_XS-0.69 for CSV for auto-detection of \r
+    - New attribute "parser" to force format
+    - Allow CSV streams
+    - Allow SC  streams
+    - Allow XLS streams
 
 0.35	Wed 03 Jun 2009
 

Modified: trunk/libspreadsheet-read-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/MANIFEST?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/MANIFEST (original)
+++ trunk/libspreadsheet-read-perl/MANIFEST Tue Nov 10 16:59:49 2009
@@ -13,6 +13,7 @@
 files/empty.ods
 files/empty.sc
 files/empty.sxc
+files/empty.txt
 files/empty.xls
 files/empty.xlsx
 files/macosx.csv
@@ -23,11 +24,15 @@
 files/perc.xlsx
 files/test.csv
 files/test_m.csv
+files/test_m.txt
 files/test.ods
 files/test.sc
 files/test.sxc
+files/test.txt
 files/test_t.csv
+files/test_t.txt
 files/test_x.csv
+files/test_x.txt
 files/test.xls
 files/test.xlsx
 files/values.xls
@@ -43,17 +48,21 @@
 t/20_csv.t
 t/21_csv.t
 t/22_csv.t
+t/23_csv.t
+t/24_csv.t
 t/30_xls.t
 t/31_clr.t
 t/33_misc.t
 t/32_fmt.t
 t/34_dates.t
 t/35_perc.t
+t/36_xls.t
 t/40_sxc.t
 t/45_ods.t
 t/46_clr.t
 t/50_sc.t
-t/60_xls.t
+t/51_sc.t
+t/60_xlsx.t
 t/61_clr.t
 t/62_fmt.t
 t/63_misc.t

Modified: trunk/libspreadsheet-read-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/META.yml?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/META.yml (original)
+++ trunk/libspreadsheet-read-perl/META.yml Tue Nov 10 16:59:49 2009
@@ -1,6 +1,6 @@
 --- #YAML:1.1
 name:                   Read
-version:                0.35
+version:                0.37
 abstract:               Meta-Wrapper for reading spreadsheet data
 license:                perl
 author:                 
@@ -10,15 +10,15 @@
 provides:
   Spreadsheet::Read:
     file:               Read.pm
-    version:            0.35
+    version:            0.37
 requires:                       
   perl:                 5.006
   Exporter:             0
   Carp:                 0
   Data::Dumper:         0
 recommends:
-  perl:                 5.008005
-  File::Temp:           0.14
+  perl:                 5.010001
+  File::Temp:           0.22
   IO::Scalar:           0
 configure_requires:
   ExtUtils::MakeMaker:  0
@@ -37,22 +37,22 @@
 - opt_csv:
     description:        Provides parsing of CSV streams
     requires:
-      Text::CSV_XS:                        0.43
+      Text::CSV_XS:                        0.69
     recommends:
-      Text::CSV:                           1.12
-      Text::CSV_PP:                        1.20
-      Text::CSV_XS:                        0.65
+      Text::CSV:                           1.15
+      Text::CSV_PP:                        1.23
+      Text::CSV_XS:                        0.69
 - opt_excel:
     description:        Provides parsing of Microsoft Excel files
     requires:
       Spreadsheet::ParseExcel:             0.26
       Spreadsheet::ParseExcel::FmtDefault: 0
     recommends:
-      Spreadsheet::ParseExcel:             0.49
+      Spreadsheet::ParseExcel:             0.55
 - opt_excelx:
     description:        Provides parsing of Microsoft Excel 2007 files
     requires:
-      Spreadsheet::XLSX:                   0.1
+      Spreadsheet::XLSX:                   0.12
       Spreadsheet::XLSX::Fmt2007:          0
 - opt_oo:
     description:        Provides parsing of OpenOffice spreadsheets

Modified: trunk/libspreadsheet-read-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/Makefile.PL?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/Makefile.PL (original)
+++ trunk/libspreadsheet-read-perl/Makefile.PL Tue Nov 10 16:59:49 2009
@@ -30,9 +30,9 @@
 	"IO::Scalar"			=> 0.00,	# Optional
 
 	# Backend parsers, all optional
-	"Text::CSV"			=> 1.00,
-	"Text::CSV_XS"			=> 0.23,	# 0.32 or up preferred
-	"Text::CSV_PP"			=> 1.05,	# 1.08 or up preferred
+	"Text::CSV"			=> 1.15,
+	"Text::CSV_XS"			=> 0.69,
+	"Text::CSV_PP"			=> 1.23,
 	"Spreadsheet::ReadSXC"		=> 0.20,
 	"Spreadsheet::ParseExcel"	=> 0.26,
 	"Spreadsheet::ParseExcel::FmtDefault" => 0,

Modified: trunk/libspreadsheet-read-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/README?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/README (original)
+++ trunk/libspreadsheet-read-perl/README Tue Nov 10 16:59:49 2009
@@ -36,6 +36,15 @@
 Recent changes can be (re)viewed in the public GIT repository at
 http://repo.or.cz/w/Spreadsheet-Read.git
 
+Feel free to clone your own copy:
+
+ $ git clone http://repo.or.cz/r/Spreadsheet-Read.git Spreadsheet-Read
+
+or get it as a tgz:
+
+ $ wget --output-document=Spreadsheet-Read-git.tgz \
+	   'http://repo.or.cz/w/Spreadsheet-Read.git?a=snapshot;sf=tgz'
+
 =head1 TODO
 
   * Make tests for examples/xlscat

Modified: trunk/libspreadsheet-read-perl/Read.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/Read.pm?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/Read.pm (original)
+++ trunk/libspreadsheet-read-perl/Read.pm Tue Nov 10 16:59:49 2009
@@ -14,6 +14,7 @@
  my $ref = ReadData ("test.ods");
  my $ref = ReadData ("test.xls");
  my $ref = ReadData ("test.xlsx");
+ my $ref = ReadData ($fh, parser => "xls");
 
  my $a3 = $ref->[1]{A3}, "\n"; # content of field A3 of sheet 1
 
@@ -22,7 +23,7 @@
 use strict;
 use warnings;
 
-our $VERSION = "0.35";
+our $VERSION = "0.37";
 sub  Version { $VERSION }
 
 use Carp;
@@ -77,20 +78,26 @@
 
 # Helper functions
 
+sub _parser
+{
+    my $type = shift		or  return "";
+    $type = lc $type;
+    # Aliases and fullnames
+    $type eq "excel"		and return "xls";
+    $type eq "excel2007"	and return "xlsx";
+    $type eq "oo"		and return "sxc";
+    $type eq "ods"		and return "sxc";
+    $type eq "openoffice"	and return "sxc";
+    $type eq "perl"		and return "prl";
+    $type eq "squirelcalc"	and return "sc";
+    return exists $can{$type} ? $type : "";
+    } # _parser
+
 # Spreadsheet::Read::parses ("csv") or die "Cannot parse CSV"
 sub parses
 {
-    my $type = shift		or  return 0;
-    $type = lc $type;
-    # Aliases and fullnames
-    $type eq "excel"		and return $can{xls};
-    $type eq "oo"		and return $can{sxc};
-    $type eq "ods"		and return $can{sxc};
-    $type eq "openoffice"	and return $can{sxc};
-    $type eq "perl"		and return $can{prl};
-
-    # $can{$type} // 0;
-    exists $can{$type} ? $can{$type} : 0;
+    my $type = _parser (shift)	or  return 0;
+    return $can{$type};
     } # parses
 
 # cr2cell (4, 18) => "D18"
@@ -139,8 +146,24 @@
 # columns in each sheet that contain no visible data
 sub _clipsheets
 {
-    my ($clip, $ref) = @_;
-    $clip or return $ref;
+    my ($opt, $ref) = @_;
+
+    if (my $s = $opt->{strip}) {
+	foreach my $sheet (1 .. $ref->[0]{sheets}) {
+	    my $ss = $ref->[$sheet];
+	    foreach my $row (1 .. $ss->{maxrow}) {
+		foreach my $col (1 .. $ss->{maxcol}) {
+		    defined $ss->{cell}[$col][$row] or next;
+		    $s & 2 && $ss->{cell}[$col][$row] =~ s/\s+$// and
+			$ss->{cr2cell ($col, $row)}   =~ s/\s+$//;
+		    $s & 1 && $ss->{cell}[$col][$row] =~ s/^\s+// and
+			$ss->{cr2cell ($col, $row)}   =~ s/^\s+//;
+		    }
+		}
+	    }
+	}
+
+    $opt->{clip} or return $ref;
 
     foreach my $sheet (1 .. $ref->[0]{sheets}) {
 	my $ss = $ref->[$sheet];
@@ -184,9 +207,6 @@
 sub ReadData
 {
     my $txt = shift	or  return;
-    ref $txt		and return; # TODO: support IO stream (ref $txt eq "IO")
-
-    my $tmpfile;
 
     my %opt;
     if (@_) {
@@ -197,20 +217,28 @@
     defined $opt{cells}	or $opt{cells}	= 1;
     defined $opt{attr}	or $opt{attr}	= 0;
     defined $opt{clip}	or $opt{clip}	= $opt{cell};
+    defined $opt{strip}	or $opt{strip}	= 0;
     defined $opt{dtfmt} or $opt{dtfmt}	= "yyyy-mm-dd"; # Format 14
 
     # $debug = $opt{debug} // 0;
     $debug = defined $opt{debug} ? $opt{debug} : 0;
     $debug > 4 and print STDERR Data::Dumper->Dump ([\%opt],["Options"]);
 
-    # CSV not supported from streams
-    if ($txt =~ m/\.(csv)$/i and -f $txt) {
+    my $io_ref = ref ($txt) =~ m/GLOB|IO/ ? $txt : undef;
+    my $io_fil = $io_ref ? 0 : do { no warnings "newline"; -f $txt ? 1 : 0 };
+    my $io_txt = $io_ref || $io_fil ? 0 : 1;
+
+    $io_fil && ! -s $txt  and return;
+    $io_ref && eof ($txt) and return;
+
+    if ($opt{parser} ? _parser ($opt{parser}) eq "csv"
+		     : ($io_fil && $txt =~ m/\.(csv)$/i)) {
 	$can{csv} or croak "CSV parser not installed";
 
-	$debug and print STDERR "Opening CSV $txt\n";
-	open my $in, "<", $txt or return;
-
-	local $/ = $/;
+	my $label = $io_fil ? $txt : "IO";
+
+	$debug and print STDERR "Opening CSV $label\n";
+
 	my $csv;
 	my @data = (
 	    {	type	=> "csv",
@@ -219,9 +247,9 @@
 		quote   => '"',
 		sepchar => ',',
 		sheets	=> 1,
-		sheet	=> { $txt => 1 },
+		sheet	=> { $label => 1 },
 		},
-	    {	label	=> $txt,
+	    {	label	=> $label,
 		maxrow	=> 0,
 		maxcol	=> 0,
 		cell	=> [],
@@ -229,94 +257,97 @@
 		},
 	    );
 
-	$_ = <$in>;
-	if (eof ($in)) {
-	    # This file is either just one single line, or uses \r as eol
-	    close $in;
-	    open  $in, "<", $txt or return;
-	    $/ = "\r";
-	    $_ = <$in>;
-	    }
-
-	my $quo = defined $opt{quote} ? $opt{quote} : '"';
-	my $sep = # If explicitly set, use it
-	   defined $opt{sep} ? $opt{sep} :
-	       # otherwise start auto-detect with quoted strings
-	       m/["0-9];["0-9;]/	? ";"  :
-	       m/["0-9],["0-9,]/	? ","  :
-	       m/["0-9]\t["0-9,]/	? "\t" :
-	       # If neither, then for unquoted strings
-	       m/\w;[\w;]/		? ";"  :
-	       m/\w,[\w,]/		? ","  :
-	       m/\w\t[\w,]/		? "\t" :
-					  ","  ;
+	my ($sep, $quo, $in) = (",", '"');
+	defined $opt{sep}   and $sep = $opt{sep};
+	defined $opt{quote} and $quo = $opt{quote};
+	if ($io_fil) {
+	    unless (defined $opt{quote} && defined $opt{sep}) {
+		local $/ = $/;
+		open $in, "<", $txt or return;
+		$_ = <$in>;
+
+		$quo = defined $opt{quote} ? $opt{quote} : '"';
+		$sep = # If explicitly set, use it
+		   defined $opt{sep} ? $opt{sep} :
+		       # otherwise start auto-detect with quoted strings
+		       m/["0-9];["0-9;]/	? ";"  :
+		       m/["0-9],["0-9,]/	? ","  :
+		       m/["0-9]\t["0-9,]/	? "\t" :
+		       # If neither, then for unquoted strings
+		       m/\w;[\w;]/		? ";"  :
+		       m/\w,[\w,]/		? ","  :
+		       m/\w\t[\w,]/		? "\t" :
+					      ","  ;
+		close $in;
+		}
+	    open $in, "<", $txt or return;
+	    }
+	else {
+	    $in = $txt;	# Now pray ...
+	    }
 	$debug > 1 and print STDERR "CSV sep_char '$sep', quote_char '$quo'\n";
 	$csv = $can{csv}->new ({
 	    sep_char       => ($data[0]{sepchar} = $sep),
 	    quote_char     => ($data[0]{quote}   = $quo),
-	    keep_meta_info => 1,	# Ignored for Text::CSV_XS <= 0.27
+	    keep_meta_info => 1,
 	    binary         => 1,
-	    eol            => $/,
 	    }) or croak "Cannot create a csv ('$sep', '$quo') parser!";
 
-	# while ($row = $csv->getline () {
-	# doesn't work, because I have to fetch the first line for auto
-	# detecting sep and quote
-	$csv->parse ($_);
-	my $row = [ $csv->fields ];
-	do {
-	    if (my @row = @$row) {
-		my $r = ++$data[1]{maxrow};
-		@row > $data[1]{maxcol} and $data[1]{maxcol} = @row;
-		foreach my $c (0 .. $#row) {
-		    my $val = $row[$c];
-		    my $cell = cr2cell ($c + 1, $r);
-		    $opt{rc}    and $data[1]{cell}[$c + 1][$r] = $val;
-		    $opt{cells} and $data[1]{$cell} = $val;
-		    $opt{attr}  and $data[1]{attr}[$c + 1][$r] = { @def_attr };
-		    }
+	while (my $row = $csv->getline ($in)) {
+	    my @row = @$row or last;
+
+	    my $r = ++$data[1]{maxrow};
+	    @row > $data[1]{maxcol} and $data[1]{maxcol} = @row;
+	    foreach my $c (0 .. $#row) {
+		my $val = $row[$c];
+		my $cell = cr2cell ($c + 1, $r);
+		$opt{rc}    and $data[1]{cell}[$c + 1][$r] = $val;
+		$opt{cells} and $data[1]{$cell} = $val;
+		$opt{attr}  and $data[1]{attr}[$c + 1][$r] = { @def_attr };
 		}
-	    else {
-		$csv = undef;
-		}
-	    } while ($csv && ($row = $csv->getline ($in)));
+	    }
 	$csv->eof () or $csv->error_diag;
 	close $in;
 
 	for (@{$data[1]{cell}}) {
 	    defined $_ or $_ = [];
 	    }
-	return _clipsheets $opt{clip}, [ @data ];
+	return _clipsheets \%opt, [ @data ];
 	}
 
     # From /etc/magic: Microsoft Office Document
-    my $xls_from_txt;
-    if ($txt =~ m/^(\376\067\0\043
-		   |\320\317\021\340\241\261\032\341
-		   |\333\245-\0\0\0)/x) {
+    if ($io_txt && _parser ($opt{parser}) !~ m/^xlsx?$/ &&
+		    $txt =~ m/^(\376\067\0\043
+			       |\320\317\021\340\241\261\032\341
+			       |\333\245-\0\0\0)/x) {
 	$can{xls} or croak "Spreadsheet::ParseExcel not installed";
+	my $tmpfile;
 	if ($can{ios}) { # Do not use a temp file if IO::Scalar is available
-	    $xls_from_txt = \$txt;
+	    $tmpfile = \$txt;
 	    }
 	else {
 	    $tmpfile = File::Temp->new (SUFFIX => ".xls", UNLINK => 1);
 	    binmode $tmpfile;
 	    print   $tmpfile $txt;
-	    $txt = "$tmpfile";
-	    }
+	    close   $tmpfile;
+	    }
+	open $io_ref, "<", $tmpfile or return;
+	$io_txt = 0;
+	$opt{parser} = "xls";
 	}
-    if ($xls_from_txt or $txt =~ m/\.(xlsx?)$/i && -f $txt) {
-	my $parse_type = $txt =~ m/\.xlsx$/i ? "XLSX" : "XLS";
+    my $_parser;
+    if ($opt{parser} ? ($_parser = _parser ($opt{parser})) =~ m/^xlsx?$/
+		     : ($io_fil && $txt =~ m/\.(xlsx?)$/i && ($_parser = $1))) {
+	my $parse_type = $_parser =~ m/x$/i ? "XLSX" : "XLS";
 	$can{lc $parse_type} or croak "Parser for $parse_type is not installed";
 	my $oBook;
-	if ($xls_from_txt) {
-	    $debug and print STDERR "Opening $parse_type \$txt\n";
+	$debug and print STDERR "Opening $parse_type \$txt\n";
+	if ($io_ref) {
 	    $oBook = $parse_type eq "XLSX"
-		? Spreadsheet::XLSX::Workbook->Parse (\$txt)
-		: Spreadsheet::ParseExcel::Workbook->Parse (\$txt);
+		? Spreadsheet::XLSX::Workbook->Parse ($io_ref)
+		: Spreadsheet::ParseExcel::Workbook->Parse ($io_ref);
 	    }
 	else {
-	    $debug and print STDERR "Opening XLS $txt\n";
 	    $oBook = $parse_type eq "XLSX"
 		? Spreadsheet::XLSX->new ($txt)
 		: Spreadsheet::ParseExcel::Workbook->Parse ($txt);
@@ -455,17 +486,25 @@
 		$data[0]{sheet}{$sheet{label}} = $#data;
 		}
 	    }
-	return _clipsheets $opt{clip}, [ @data ];
+	return _clipsheets \%opt, [ @data ];
 	}
 
-    if ($txt =~ m/^# .*SquirrelCalc/ or $txt =~ m/\.sc$/ && -f $txt) {
-	if ($txt !~ m/\n/ && -f $txt) {
+    if ($opt{parser} ? _parser ($opt{parser}) eq "sc"
+		     : $io_fil
+			 ? $txt =~ m/\.sc$/
+			 : $txt =~ m/^# .*SquirrelCalc/) {
+	if ($io_ref) {
+	    local $/;
+	    my $x = <$txt>;
+	    $txt = $x;
+	    }
+	elsif ($io_fil) {
 	    local $/;
 	    open my $sc, "<", $txt or return;
 	    $txt = <$sc>;
 	    close   $sc;
-	    $txt =~ m/\S/ or return;
-	    }
+	    }
+	$txt =~ m/\S/ or return;
 	my @data = (
 	    {	type	=> "sc",
 		parser	=> "Spreadsheet::Read",
@@ -501,10 +540,11 @@
 	for (@{$data[1]{cell}}) {
 	    defined $_ or $_ = [];
 	    }
-	return _clipsheets $opt{clip}, [ @data ];
+	return _clipsheets \%opt, [ @data ];
 	}
 
-    if ($txt =~ m/^<\?xml/ or -f $txt) {
+    if ($opt{parser} ? _parser ($opt{parser}) eq "sxc"
+		     : ($txt =~ m/^<\?xml/ or -f $txt)) {
 	$can{sxc} or croak "Spreadsheet::ReadSXC not installed";
 	my $sxc_options = { OrderBySheet => 1 }; # New interface 0.20 and up
 	my $sxc;
@@ -574,7 +614,7 @@
 		$data[0]{sheets}++;
 		$data[0]{sheet}{$sheet->{label}} = $#data;
 		}
-	    return _clipsheets $opt{clip}, [ @data ];
+	    return _clipsheets \%opt, [ @data ];
 	    }
 	}
 
@@ -662,12 +702,13 @@
 
 =item my $ref = ReadData ($content);
 
+=item my $ref = ReadData ($fh, parser => "xls");
+
 Tries to convert the given file, string, or stream to the data
 structure described above.
 
-Precessing data from a stream or content is supported for Excel
-(through a File::Temp temporary file or IO::Scalar when available),
-or for XML (OpenOffice), but not for CSV.
+Processing Excel data from a stream or content is supported through
+a File::Temp temporary file or IO::Scalar when available.  
 
 ReadSXC does preserve sheet order as of version 0.20.
 
@@ -675,6 +716,15 @@
 
 =over 2
 
+=item parser
+
+Force the data to be parsed by a specific format. Possible values are
+C<csv>, C<prl> (or C<perl>), C<sc> (or C<squirelcalc>), C<sxc> (or C<oo>,
+C<ods>, C<openoffice>) C<xls> (or C<excel>), and C<xlsx> (or C<excel2007>).
+
+When parsing streams, instead of files, it is highly recommended to pass
+this option.
+
 =item cells
 
 Control the generation of named cells ("A1" etc). Default is true.
@@ -686,6 +736,7 @@
 =item attr
 
 Control the generation of the {attr}[c][r] entries. Default is false.
+See L<Cell Attributes> below.
 
 =item clip
 
@@ -693,6 +744,18 @@
 sheet that have no visual data.
 This option is only valid if C<cells> is true. The default value is
 true if C<cells> is true, and false otherwise.
+
+=item strip
+
+If set, C<ReadData ()> will remove trailing- and/or leading-whitespace
+from every field.
+
+  strip  leading  strailing
+  -----  -------  ---------
+    0      n/a      n/a
+    1     strip     n/a
+    2      n/a     strip
+    3     strip    strip
 
 =item sep
 
@@ -725,11 +788,21 @@
 
 =back
 
-In case of CSV parsing, C<ReadData ()> will use the first line to
-auto-detect the separation character, if not explicitly passed, and the
-end-of-line sequence. This means that if the first line does not contain
-embedded newlines, the rest of the CSV file can have them, and they will
-be parsed correctly.
+=back
+
+=head2 Using CSV
+
+In case of CSV parsing, C<ReadData ()> will use the first line of the file
+to auto-detect the separation character if the first argument is a file and
+both C<sep> and C<quote> are not passed as attributes. Text::CSV_XS (or
+Text::CSV_PP) is able to automatically detect and use C<\r> line endings).
+
+CSV can parse streams too, but be sure to pass C<sep> and/or C<quote> if
+these do not match the default C<,> and C<">.
+
+=head2 Functions
+
+=over 4
 
 =item my $cell = cr2cell (col, row)
 
@@ -780,63 +853,65 @@
 
 =back
 
+=head2 Cell Attributes
+
+If the constructor was called with C<attr> having a true value, effort
+is made to analyse and store field attributes like this:
+
+    { label  => "Sheet 1",
+      maxrow => 2,
+      maxcol => 4,
+      cell   => [ undef,
+	[ undef, 1 ],
+	[ undef, undef, undef, undef, undef, "Nugget" ],
+	],
+      attr   => [ undef,
+	[ undef, {
+	  type    => "numeric",
+	  fgcolor => "#ff0000",
+	  bgcolor => undef,
+	  font    => "Arial",
+	  size    => undef,
+	  format  => "## ##0.00",
+	  halign  => "right",
+	  valign  => "top",
+	  uline   => 0,
+	  bold    => 0,
+	  italic  => 0,
+	  wrap    => 0,
+	  merged  => 0,
+	  hidden  => 0,
+	  locked  => 0,
+	  enc     => "utf-8",
+	  }, ]
+	[ undef, undef, undef, undef, undef, {
+	  type    => "text",
+	  fgcolor => "#e2e2e2",
+	  bgcolor => undef,
+	  font    => "Letter Gothic",
+	  size    => 15,
+	  format  => undef,
+	  halign  => "left",
+	  valign  => "top",
+	  uline   => 0,
+	  bold    => 0,
+	  italic  => 0,
+	  wrap    => 0,
+	  merged  => 0,
+	  hidden  => 0,
+	  locked  => 0,
+	  enc     => "iso8859-1",
+	  }, ]
+      A1     => 1,
+      B5     => "Nugget",
+      },
+
+This has now been partially implemented, mainly for Excel, as the other
+parsers do not (yet) support all of that. YMMV.
+
 =head1 TODO
 
 =over 4
-
-=item Cell attributes
-
-Future plans include cell attributes, available as for example:
-
-        { label  => "Sheet 1",
-          maxrow => 2,
-          maxcol => 4,
-          cell   => [ undef,
-            [ undef, 1 ],
-            [ undef, undef, undef, undef, undef, "Nugget" ],
-            ],
-          attr   => [ undef,
-            [ undef, {
-              type    => "numeric",
-              fgcolor => "#ff0000",
-              bgcolor => undef,
-              font    => "Arial",
-              size    => undef,
-              format  => "## ##0.00",
-              halign  => "right",
-              valign  => "top",
-              uline   => 0,
-              bold    => 0,
-              italic  => 0,
-              wrap    => 0,
-              merged  => 0,
-              hidden  => 0,
-              locked  => 0,
-              enc     => "utf-8",
-              }, ]
-            [ undef, undef, undef, undef, undef, {
-              type    => "text",
- 	      fgcolor => "#e2e2e2",
-              bgcolor => undef,
-              font    => "Letter Gothic",
-              size    => 15,
-              format  => undef,
-              halign  => "left",
-              valign  => "top",
-              uline   => 0,
-              bold    => 0,
-              italic  => 0,
-              wrap    => 0,
-              merged  => 0,
-              hidden  => 0,
-              locked  => 0,
- 	      enc     => "iso8859-1",
- 	      }, ]
- 	  A1     => 1,
- 	  B5     => "Nugget",
- 	  },
-
-This has now been partially implemented. Excel only.
 
 =item Options
 

Modified: trunk/libspreadsheet-read-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/debian/changelog?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/debian/changelog (original)
+++ trunk/libspreadsheet-read-perl/debian/changelog Tue Nov 10 16:59:49 2009
@@ -1,8 +1,13 @@
-libspreadsheet-read-perl (0.35-2) UNRELEASED; urgency=low
+libspreadsheet-read-perl (0.37-1) UNRELEASED; urgency=low
 
+  [ Jonathan Yu ]
+  * New upstream release
+  * Update dependencies per upstream
+
+  [ Ryan Niebur ]
   * Update ryan52's email address
 
- -- Ryan Niebur <ryan at debian.org>  Fri, 25 Sep 2009 00:26:24 -0700
+ -- Jonathan Yu <jawnsy at cpan.org>  Tue, 10 Nov 2009 07:37:00 -0500
 
 libspreadsheet-read-perl (0.35-1) unstable; urgency=low
 

Modified: trunk/libspreadsheet-read-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libspreadsheet-read-perl/debian/control?rev=46975&op=diff
==============================================================================
--- trunk/libspreadsheet-read-perl/debian/control (original)
+++ trunk/libspreadsheet-read-perl/debian/control Tue Nov 10 16:59:49 2009
@@ -2,16 +2,16 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7.0.50), quilt (>= 0.46-7)
-Build-Depends-Indep: perl (>= 5.6.10-12), libtest-pod-perl,
- libtest-pod-coverage-perl, libtext-csv-perl (>= 1.12),
- libtext-csv-xs-perl (>= 0.65), libspreadsheet-parseexcel-perl (>= 0.4900),
- libspreadsheet-xlsx-perl (>= 0.10), libtest-nowarnings-perl,
+Build-Depends-Indep: perl, libtest-pod-perl,
+ libtest-pod-coverage-perl, libtext-csv-perl (>= 1.15),
+ libtext-csv-xs-perl (>= 0.69), libspreadsheet-parseexcel-perl (>= 0.5500),
+ libspreadsheet-xlsx-perl (>= 0.12), libtest-nowarnings-perl,
  libtest-simple-perl (>= 0.88)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Jeremiah C. Foster <jeremiah at jeremiahfoster.com>,
  Jose Luis Rivas <ghostbar38 at gmail.com>,
  gregor herrmann <gregoa at debian.org>, Ryan Niebur <ryan at debian.org>
-Standards-Version: 3.8.2
+Standards-Version: 3.8.3
 Homepage: http://search.cpan.org/dist/Spreadsheet-Read/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libspreadsheet-read-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libspreadsheet-read-perl/
@@ -19,9 +19,9 @@
 Package: libspreadsheet-read-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, libio-stringy-perl,
- libtext-csv-perl (>= 1.12)
-Recommends: libtext-csv-xs-perl (>= 0.65),
- libspreadsheet-parseexcel-perl (>= 0.4900), libspreadsheet-xlsx-perl (>= 0.10)
+ libtext-csv-perl (>= 1.15)
+Recommends: libtext-csv-xs-perl (>= 0.69),
+ libspreadsheet-parseexcel-perl (>= 0.5500), libspreadsheet-xlsx-perl (>= 0.12)
 Suggests: perl-tk, libtk-tablematrix-perl
 Description: reader for common spreadsheet formats and return the data
  Spreadsheet::Read tries to transparently read *any* spreadsheet and return




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