in reply to Re^2: memory usage Spreadsheet::ParseExcel
in thread memory usage Spreadsheet::ParseExcel

"the referenced object has been blessed into a package, then that package name is returned instead.

Switching from ref to Scalar::Util::reftype() would fix that.

and ::Worksheet warned on deep recursion and never came back up out of the stack

Using Scalar::Util::refaddr() with a %seen hash could prevent it recursing up its own bum.

The code I posted was by way of example. Just a blind tweak of a depth-first recursive structure traversal I had kicking around.

I'd have a go a making the above tweaks if I had a suitable example .xls file.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^4: memory usage Spreadsheet::ParseExcel
by Anonymous Monk on May 15, 2012 at 00:23 UTC
    BrowserUk (Pope)

    here you go then pardner

    http://specialprojects.invisionzone.com/index.php?/topic/10-memory-usage-spreadsheetparseexcel/

      Ignore this. It helps if you wait for the file to fully download before trying to parse it. 8{

      Hm. I downloaded that and ran this:

      use Spreadsheet::ParseExcel; my $parser = Spreadsheet::ParseExcel->new(); my $workbook; { local $^W; $workbook = $parser->parse('C:/Downloaded/DEC_10_DP_DPDP1.xls') or + die $!, $^E; }

      Without disabling the warnings I get gazillions of these:

      Use of uninitialized value $iBlock in numeric lt (<) at c:/Perl64/site +/lib/OLE/Storage_Lite.pm line 1246. Use of uninitialized value $iBlock in addition (+) at c:/Perl64/site/l +ib/OLE/Storage_Lite.pm line 1165. Use of uninitialized value in numeric ne (!=) at c:/Perl64/site/lib/OL +E/Storage_Lite.pm line 1107. Use of uninitialized value in numeric ne (!=) at c:/Perl64/site/lib/OL +E/Storage_Lite.pm line 1107.

      And $workbook is undef with these errors reported:

      Bad file descriptor The handle is invalid at C:\test\recuriveFree.pl l +ine 34.

      I've installed teh latest versions available of everything that seems relevant:

      C:\test>ppm-shell ppm 4.10 (ActivePerl 1007) Copyright (C) 2010 ActiveState Software Inc. All rights reserved. ppm> search Win32::OLE 1: Win32-OLE OLE Automation extensions Version: 0.1709 Released: 2008-04-18 Author: Jan Dubois <jand@activestate.com> Provide: Win32::OLE version 0.1709 Provide: Win32::OLE::Const Provide: Win32::OLE::TypeInfo Provide: Win32::OLE::Variant Repo: ActiveState Package Repository CPAN: http://search.cpan.org/dist/Win32-OLE-0.1709/ Installed: 0.1709 (perl) ppm> search OLE-Storage_Lite 1: OLE-Storage_Lite Read and write OLE storage files. Version: 0.19 Released: 2009-11-24 Author: John McNamara <jmcnamara@cpan.org> Provide: OLE::Storage_Lite version 0.19 Repo: ActiveState Package Repository CPAN: http://search.cpan.org/dist/OLE-Storage_Lite-0.19/ Installed: 0.19 (site) ppm> search Spreadsheet::ParseExcel 1: Spreadsheet-ParseExcel Read information from an Excel file. Version: 0.59 Released: 2011-04-06 Author: John McNamara <jmcnamara@cpan.org> Provide: Spreadsheet::ParseExcel version 0.59 Provide: Spreadsheet::ParseExcel::Cell version 0.59 Provide: Spreadsheet::ParseExcel::Dump version 0.59 Provide: Spreadsheet::ParseExcel::FmtDefault version 0.59 Provide: Spreadsheet::ParseExcel::FmtJapan version 0.59 Provide: Spreadsheet::ParseExcel::FmtJapan2 version 0.59 Provide: Spreadsheet::ParseExcel::FmtUnicode version 0.59 Provide: Spreadsheet::ParseExcel::Font version 0.59 Provide: Spreadsheet::ParseExcel::Format version 0.59 Provide: Spreadsheet::ParseExcel::SaveParser version 0.59 Provide: Spreadsheet::ParseExcel::SaveParser::Workbook version 0.59 Provide: Spreadsheet::ParseExcel::SaveParser::Worksheet version 0.5 +9 Provide: Spreadsheet::ParseExcel::Utility version 0.59 Provide: Spreadsheet::ParseExcel::Workbook version 0.59 Provide: Spreadsheet::ParseExcel::Worksheet version 0.59 Require: Crypt::RC4 Require: Digest::Perl::MD5 Require: IO::File Require: IO::Scalar Require: OLE::Storage_Lite version 0.19 or better Require: Scalar::Util Repo: ActiveState Package Repository CPAN: http://search.cpan.org/dist/Spreadsheet-ParseExcel-0.59/ Installed: 0.59 (site)
      Perhaps you could checksum the file so I can check for corruption; or advise what I'm doing wrong?

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?