alvinstarr has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use OLE::Storage_Lite. I read an OLE and write the file using the following code
my $oOl = OLE::Storage_Lite->new("test.story"); my $oPps = $oOl->getPpsTree(1); print "\n"; $oPps->save("savefile.story");
the resulting file is not the same size as the original file and for any complex files the data seems to be corrupt even by the '/usr/bin/file' command. Any help would be appreciated.

Replies are listed 'Best First'.
Re: OLE::Storage_Lite problems
by Anonymous Monk on Apr 16, 2014 at 19:57 UTC
      I used smpaddF.pl and added a section.
      { my $oOl = OLE::Storage_Lite->new('test.xls'); my $oPps = $oOl->getPpsTree(1); die( "test.xls must be a OLE file") unless($oPps); my $oFile = new IO::File; $oFile->open('test.tmp', 'r'); $oPps->save('add_none.xls'); }
      16 -rw-rw-r--. 1 alvin alvin 15872 Apr 16 16:33 add_io2.xls 16 -rw-rw-r--. 1 alvin alvin 15872 Apr 16 16:33 add_io.xls 16 -rw-rw-r--. 1 alvin alvin 15872 Apr 16 16:33 add_name.xls 16 -rw-rw-r--. 1 alvin alvin 14336 Apr 16 16:33 add_none.xls 16 -rw-rw-r--. 1 alvin alvin 15872 Apr 16 16:33 add_test.xls 16 -rw-rw-r--. 1 alvin alvin 15872 Apr 16 16:33 add_tmp.xls 16 -rw-r--r--. 1 alvin alvin 13824 Apr 16 16:31 test.xls
      Test.xls and add_none.xls are different sizes and I expect them to be the same size. Should I not expect them to be the same sizes?

        I think you'll have to ask the author rt://OLE-Storage_Lite

        Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. go at trythis.pl line 124. new file at trythis.pl line 128. trying to save at trythis.pl line 132. Day '' out of range 1..31 at .../site/lib/OLE/Storage_Lite.pm line 136 +7. end at trythis.pl line 137. 11/23/2009 06:03 PM 13,824 test.xls 04/16/2014 02:21 PM 13,952 add_test.xls 04/16/2014 02:21 PM 12 test.tmp 04/16/2014 02:21 PM 13,952 add_name.xls 04/16/2014 02:21 PM 13,952 add_tmp.xls 04/16/2014 02:21 PM 13,952 add_io2.xls 04/16/2014 02:21 PM 13,952 add_io.xls 04/16/2014 02:21 PM 12,928 add_none.xls

        When I compare test.xls and add_none.xls, (and when I use "strings" program and compare the output), I find test.xls has extra section that is missing in add_none.xls

        when I right click on test.xls and click properties, there are two extra tabs, custom and summary

        All the add_ files are missing these, including add_none

        To me this explains the difference

        Now the fatal error I get which I trap with eval, could be responsible for the missing properties...

        I would ask the author rt://OLE-Storage_Lite if its a mistake (I think its likely) or intentional