r23957 - in /branches/upstream/libspreadsheet-xlsx-perl: ./ current/ current/lib/ current/lib/Spreadsheet/ current/t/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Fri Aug 8 17:45:46 UTC 2008


Author: gregoa
Date: Fri Aug  8 17:45:44 2008
New Revision: 23957

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=23957
Log:
[svn-inject] Installing original source of libspreadsheet-xlsx-perl

Added:
    branches/upstream/libspreadsheet-xlsx-perl/
    branches/upstream/libspreadsheet-xlsx-perl/current/
    branches/upstream/libspreadsheet-xlsx-perl/current/Changes   (with props)
    branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST   (with props)
    branches/upstream/libspreadsheet-xlsx-perl/current/META.yml
    branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL   (with props)
    branches/upstream/libspreadsheet-xlsx-perl/current/README   (with props)
    branches/upstream/libspreadsheet-xlsx-perl/current/lib/
    branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/
    branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm   (with props)
    branches/upstream/libspreadsheet-xlsx-perl/current/t/
    branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t   (with props)

Added: branches/upstream/libspreadsheet-xlsx-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/Changes?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/Changes (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/Changes Fri Aug  8 17:45:44 2008
@@ -1,0 +1,17 @@
+Revision history for Perl extension Spreadsheet::XLSC.
+
+0.01  Thu Mar 13 09:41:52 2008
+
+	- original version; created by h2xs 1.23 with options
+		-A -X -n Spreadsheet::XLSC --skip-exporter --skip-autoloader
+
+0.02  Mon May 12 07:02:31 UTC 2008
+
+	- fixed a bug with 1st dictionnary string (thanx SSIMMS: http://rt.cpan.org/Public/Bug/Display.html?id=35489)
+	- prereq relaxed (thanx SSIMMS: http://rt.cpan.org/Public/Bug/Display.html?id=35490)
+	
+0.03  Tue May 20 05:18:41 UTC 2008
+
+	- fixed the incorrect mapping for columns > AA (thanx JMELTZER http://rt.cpan.org/Public/Bug/Display.html?id=36013)
+	- added support for r:id attribute (Ibid)
+

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/Changes
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST Fri Aug  8 17:45:44 2008
@@ -1,0 +1,7 @@
+Changes
+lib/Spreadsheet/XLSX.pm
+Makefile.PL
+MANIFEST			This list of files
+README
+t/Spreadsheet-XLSX.t
+META.yml                                 Module meta-data (added by MakeMaker)

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/MANIFEST
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libspreadsheet-xlsx-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/META.yml?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/META.yml (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/META.yml Fri Aug  8 17:45:44 2008
@@ -1,0 +1,14 @@
+--- #YAML:1.0
+name:                Spreadsheet-XLSX
+version:             0.03
+abstract:            Perl extension for reading MS Excel 2007 files;
+license:             ~
+author:              
+    - Dmitry Ovsyanko <do at eludia.ru>
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+    Archive::Zip:                  1.18
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Added: branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL Fri Aug  8 17:45:44 2008
@@ -1,0 +1,14 @@
+use 5.008005;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    NAME              => 'Spreadsheet::XLSX',
+    VERSION_FROM      => 'lib/Spreadsheet/XLSX.pm', # finds $VERSION
+    PREREQ_PM         => {
+	'Archive::Zip' => 1.18,
+    }, # e.g., Module::Name => 1.1
+    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
+      (ABSTRACT_FROM  => 'lib/Spreadsheet/XLSX.pm', # retrieve abstract from module
+       AUTHOR         => 'Dmitry Ovsyanko <do at eludia.ru>') : ()),
+);

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/Makefile.PL
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libspreadsheet-xlsx-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/README?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/README (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/README Fri Aug  8 17:45:44 2008
@@ -1,0 +1,29 @@
+Spreadsheet-XLSC version 0.01
+=============================
+
+Spreadsheet::XLSX - Perl extension for reading MS Excel 2007 files;
+
+INSTALLATION
+
+To install this module type the following:
+
+   perl Makefile.PL
+   make
+   make test
+   make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+  Archive::Zip
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2008 by Dmitry Ovsyanko
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.8 or,
+at your option, any later version of Perl 5 you may have available.
+
+

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/README
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm Fri Aug  8 17:45:44 2008
@@ -1,0 +1,259 @@
+package Spreadsheet::XLSX;
+
+use 5.008008;
+use strict;
+use warnings;
+
+our @ISA = qw();
+
+our $VERSION = '0.03';
+
+use Archive::Zip;
+
+use Data::Dumper;
+
+################################################################################
+
+sub new {
+
+	my ($class, $filename, $converter) = @_;
+	
+	my $self = {};
+	
+	$self -> {zip} = Archive::Zip -> new ($filename) or die ("Cant't open $filename as a zip file\n");	
+	
+	my $member_shared_strings = $self -> {zip} -> memberNamed ('xl/sharedStrings.xml');
+	
+	my @shared_strings = ();
+
+	if ($member_shared_strings) {
+	
+		foreach my $t ($member_shared_strings -> contents =~ /t\>([^\<]*)\<\/t/gsm) {
+			
+			$t = $converter -> convert ($t) if $converter;
+			
+			push @shared_strings, $t;
+		
+		}
+	
+	}
+		
+	my $member_workbook = $self -> {zip} -> memberNamed ('xl/workbook.xml') or die ("xl/workbook.xml not found in this zip\n");
+			
+	my @Worksheet = ();
+	
+	foreach ($member_workbook -> contents =~ /\<(.*?)\/?\>/g) {
+	
+		/^(\w+)\s+/;
+		
+		my ($tag, $other) = ($1, $');
+
+		my @pairs = split /\" /, $other;
+
+		$tag eq 'sheet' or next;
+		
+		my $sheet = {
+			MaxRow => 0,
+			MaxCol => 0,
+			MinRow => 1000000,
+			MinCol => 1000000,
+		};
+		
+		foreach ($other =~ /(\S+=".*?")/gsm) {
+
+			my ($k, $v) = split /=?"/;
+	
+			if ($k eq 'name') {
+				$sheet -> {Name} = $v;
+				$sheet -> {Name} = $converter -> convert ($sheet -> {Name}) if $converter;
+			}
+			elsif ($k eq 'r:id') {
+				($sheet -> {Id}) = $v =~ m{rId(\d+)};
+			};
+					
+		}
+		
+		push @Worksheet, $sheet;
+				
+	}
+
+	$self -> {Worksheet} = \@Worksheet;
+	
+	foreach my $sheet (@Worksheet) {
+	
+		my $member_name  = "xl/worksheets/sheet$sheet->{Id}.xml";
+	
+		my $member_sheet = $self -> {zip} -> memberNamed ($member_name) or die ("$member_name not found in this zip\n");
+	
+		my ($row, $col);
+		
+		my $flag = 0;
+		my $s    = 0;
+		
+		foreach ($member_sheet -> contents =~ /(\<.*?\/?\>|.*?(?=\<))/g) {
+		
+			if (/^\<c r=\"([A-Z])([A-Z]?)(\d+)\"/) {
+				
+				$col = ord ($1) - 65;
+				
+				if ($2) {
+                    $col++;
+					$col *= 26;
+					$col += (ord ($2) - 65);
+				}
+				
+				$row = $3 - 1;
+				
+				$s = /t=\"s\"/ ? 1 : 0;
+				
+			}
+			elsif (/^<v/) {
+				$flag = 1;
+			}
+			elsif (/^<\/v/) {
+				$flag = 0;
+			}
+			elsif (length ($_) && $flag) {
+			
+				my $v = $s ? $shared_strings [$_] : $_;
+			
+				$sheet -> {MaxRow} = $row if $sheet -> {MaxRow} < $row;
+				$sheet -> {MaxCol} = $col if $sheet -> {MaxCol} < $col;
+				$sheet -> {MinRow} = $row if $sheet -> {MinRow} > $row;
+				$sheet -> {MinCol} = $col if $sheet -> {MinCol} > $col;
+				
+				$sheet -> {Cells} [$row] [$col] = {
+
+					Val    => $v,
+					_Value => $v,
+					
+				};
+			
+			}
+					
+		}
+		
+		$sheet -> {MinRow} = 0 if $sheet -> {MinRow} > $sheet -> {MaxRow};
+		$sheet -> {MinCol} = 0 if $sheet -> {MinCol} > $sheet -> {MaxCol};
+
+	}
+	
+	bless ($self, $class);
+
+	return $self;
+
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Spreadsheet::XLSX - Perl extension for reading MS Excel 2007 files;
+
+=head1 SYNOPSIS
+
+ use Text::Iconv;
+ my $converter = Text::Iconv -> new ("utf-8", "windows-1251");
+ 
+ # Text::Iconv is not really required.
+ # This can be any object with the convert method. Or nothing.
+
+ use Spreadsheet::XLSX;
+ 
+ my $excel = Spreadsheet::XLSX -> new ('test.xlsx', $converter);
+ 
+ foreach my $sheet (@{$excel -> {Worksheet}}) {
+ 
+ 	printf("Sheet: %s\n", $sheet->{Name});
+ 	
+ 	$sheet -> {MaxRow} ||= $sheet -> {MinRow};
+ 	
+         foreach my $row ($sheet -> {MinRow} .. $sheet -> {MaxRow}) {
+         
+ 		$sheet -> {MaxCol} ||= $sheet -> {MinCol};
+ 		
+ 		foreach my $col ($sheet -> {MinCol} ..  $sheet -> {MaxCol}) {
+ 		
+ 			my $cell = $sheet -> {Cells} [$row] [$col];
+ 
+ 			if ($cell) {
+ 			    printf("( %s , %s ) => %s\n", $row, $col, $cell -> {Val});
+ 			}
+ 
+ 		}
+ 
+ 	}
+ 
+ }
+
+=head1 DESCRIPTION
+
+This module is a (quick and dirty) emulation of Spreadsheet::ParseExcel for 
+Excel 2007 (.xlsx) file format.
+
+=head1 SEE ALSO
+
+=over 2
+
+=item Text::CSV_XS, Text::CSV_PP
+
+http://search.cpan.org/~hmbrand/
+
+A pure perl version is available on http://search.cpan.org/~makamaka/
+
+=item Spreadsheet::ParseExcel
+
+http://search.cpan.org/~kwitknr/
+
+=item Spreadsheet::ReadSXC
+
+http://search.cpan.org/~terhechte/
+
+=item Spreadsheet::BasicRead
+
+http://search.cpan.org/~gng/ for xlscat likewise functionality (Excel only)
+
+=item Spreadsheet::ConvertAA
+
+http://search.cpan.org/~nkh/ for an alternative set of cell2cr () /
+cr2cell () pair
+
+=item Spreadsheet::Perl
+
+http://search.cpan.org/~nkh/ offers a Pure Perl implementation of a
+spreadsheet engine. Users that want this format to be supported in
+Spreadsheet::Read are hereby motivated to offer patches. It's not high
+on my todo-list.
+
+=item xls2csv
+
+http://search.cpan.org/~ken/ offers an alternative for my C<xlscat -c>,
+in the xls2csv tool, but this tool focusses on character encoding
+transparency, and requires some other modules.
+
+=item Spreadsheet::Read
+
+http://search.cpan.org/~hmbrand/ read the data from a spreadsheet (interface 
+module)
+
+=back
+
+=head1 AUTHOR
+
+Dmitry Ovsyanko, E<lt>do at eludia.ru<gt>, http://eludia.ru/wiki/
+
+Patches by:
+
+	Steve Simms
+	Joerg Meltzer
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2008 by Dmitry Ovsyanko
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.8 or,
+at your option, any later version of Perl 5 you may have available.
+
+=cut

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/lib/Spreadsheet/XLSX.pm
------------------------------------------------------------------------------
    svn:executable = 

Added: branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t?rev=23957&op=file
==============================================================================
--- branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t (added)
+++ branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t Fri Aug  8 17:45:44 2008
@@ -1,0 +1,19 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Spreadsheet-XLSC.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test::More tests => 2;
+
+BEGIN {
+	use_ok ('Archive::Zip');
+	use_ok ('Spreadsheet::XLSX');
+};
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+

Propchange: branches/upstream/libspreadsheet-xlsx-perl/current/t/Spreadsheet-XLSX.t
------------------------------------------------------------------------------
    svn:executable = 




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