Subject: | Ability to read xlsx from filehandle |
There is need in Spreadsheet::XLSX to have an ability
to read data from file handle, not only from disk file, specified by
its filename.
This will give an opportunity to work without on-disk files e.g.
processing xlsx data coming from pipe or network or any other source
that can be read into string and then opened via IO::String.
Patch implementing this functionality is attached to this bugreport.
Thanks in advance!
--
Sergey Pushkin
Subject: | spreadsheet-xlsx-fh.patch |
--- XLSX.pm.orig 2010-05-14 12:20:25.000000000 +0800
+++ XLSX.pm 2010-05-14 14:57:12.000000000 +0800
@@ -21,7 +21,12 @@
my $self = {};
- $self -> {zip} = Archive::Zip -> new ($filename) or die ("Cant't open $filename as a zip file\n");
+ $self -> {zip} = Archive::Zip -> new ();
+ if (ref $filename) {
+ $self -> {zip} -> readFromFileHandle ($filename) == Archive::Zip::AZ_OK or die ("Cannot open data as Zip archive");
+ } else {
+ $self -> {zip} -> read ($filename) == Archive::Zip::AZ_OK or die ("Cannot open $filename as Zip archive");
+ };
my $member_shared_strings = $self -> {zip} -> memberNamed ('xl/sharedStrings.xml');