OLE::Storage_Lite(3)
β¨ OLE::Storage_Lite β¨
okay bestie, gather round, because we're talking about OLE::Storage_Lite β the simple class for OLE document interface (that's the NAME, no cap). It's the little Perl module that lets you poke at those chonky OLE structured files (yes, the .xls ones, iykyk). π
πΈ SYNOPSIS πΈ
use OLE::Storage_Lite;
# Initialize.
# From a file
my $oOl = OLE::Storage_Lite->new("some.xls");
# From a filehandle object
use IO::File;
my $oIo = new IO::File;
$oIo->open("iofile.xls", "r");
binmode($oIo);
my $oOl = OLE::Storage_Lite->new($oFile);
# Read data
my $oPps = $oOl->getPpsTree(1);
# Save Data
# To a File
$oPps->save("kaba.xls"); #kaba.xls
$oPps->save('-'); #STDOUT
# To a filehandle object
my $oIo = new IO::File;
$oIo->open("iofile.xls", "w");
binmode($oIo);
$oPps->save($oIo);
π¦ DESCRIPTION π¦
OLE::Storage_Lite lets you read and write an OLE structured file. That's the whole vibe. It's giving "I contain multitudes but also spreadsheets." π
OLE::Storage_Lite::PPS is the class that represents a PPS. And then:
OLE::Storage_Lite::PPS::RootOLE::Storage_Lite::PPS::FileOLE::Storage_Lite::PPS::Dir
are all subclasses of OLE::Storage_Lite::PPS. A whole little family tree, honestly adorable. π³
π new() π
The constructor, bestie. The main character entrance.
$oOle = OLE::Storage_Lite->new($sFile);
It creates a OLE::Storage_Lite object for $sFile. And heads up β $sFile must be a correct file name.
The new() constructor also accepts a valid filehandle. And no, you cannot skip this part: remember to binmode() the filehandle first. Do it. Don't be chaotic. π
π getPpsTree() π
$oPpsRoot = $oOle->getPpsTree([$bData]);
Returns PPS as an OLE::Storage_Lite::PPS::Root object. Other PPS objects will be included as its children (they're just tagging along, it's fine, it's cute).
If $bData is true, the objects will have data in the file.
π getPpsSearch() π
$oPpsRoot = $oOle->getPpsTree($raName [, $bData][, $iCase] );
Returns PPSs as OLE::Storage_Lite::PPS objects that has the name specified in $raName array. (Yes, that's the syntax exactly as written β we don't editorialize around here.)
If $bData is true, the objects will have data in the file. If $iCase is true, search is case insensitive. Slay, flexible queen. β¨
π getNthPps() π
$oPpsRoot = $oOle->getNthPps($iNth [, $bData]);
Returns PPS as "OLE::Storage_Lite::PPS" object specified number $iNth. You want the nth one? You get the nth one. Numbered. Ordered. Iconic.
If $bData is true, the objects will have data in the file.
π Asc2Ucs() π
$sUcs2 = OLE::Storage_Lite::Asc2Ucs($sAsc>);
Utility function. It literally just adds 0x00 after every characters in $sAsc. That's it. That's the job. Lowkey a one-trick pony and we love her for it. π΄
π Ucs2Asc() π
$sAsc = OLE::Storage_Lite::Ucs2Asc($sUcs2);
Utility function. Just deletes 0x00 after words in $sUcs. The inverse queen. π
π OLE::Storage_Lite::PPS π
OLE::Storage_Lite::PPS has these properties. Property tour, let's go:
- No β Order number in saving.
- Name β Its name in UCS2 (a.k.a Unicode).
- Type β Its type (1:Dir, 2:File (Data), 5: Root)
- PrevPps β Previous pps (as No)
- NextPps β Next pps (as No)
- DirPps β Dir pps (as No).
- Time1st β Timestamp 1st in array ref as similar format of localtime.
- Time2nd β Timestamp 2nd in array ref as similar format of localtime.
- StartBlock β Start block number
- Size β Size of the pps
- Data β Its data
- Child β Its child PPSs in array ref
π§ OLE::Storage_Lite::PPS::Root π§
OLE::Storage_Lite::PPS::Root has 2 methods. Two. A duo. A power pair. π«
π new() π
$oRoot = OLE::Storage_Lite::PPS::Root->new(
$raTime1st,
$raTime2nd,
$raChild);
Constructor, obviously.
$raTime1st, $raTime2nd are array refs with ($iSec, $iMin, $iHour, $iDay, $iMon, $iYear). Let's break that down so nothing gets lost:
$iSecmeans seconds$iMinmeans minutes$iHourmeans hours$iDaymeans day$iMonis month -1$iYearis year - 1900
$raChild is a array ref of children PPSs.
π save() π
$oRoot = $oRoot>->save(
$sFile,
$bNoAs);
Saves information into $sFile. If $sFile is '-', this will use STDOUT. (Shoutout to the terminal. We see you. π₯οΈ)
The new() constructor also accepts a valid filehandle. Remember to binmode() the filehandle first. (Same rule as before, bestie, it never stops applying.)
If $bNoAs is defined, this function will use the No of PPSs for saving order. If $bNoAs is undefined, this will calculate PPS saving order. Either way, it's saving. We're saving. πΎ
π OLE::Storage_Lite::PPS::Dir π
OLE::Storage_Lite::PPS::Dir has 1 method. Just the one. She's focused. She's minimal. She's that girl.
π new() π
$oRoot = OLE::Storage_Lite::PPS::Dir->new(
$sName,
[, $raTime1st]
[, $raTime2nd]
[, $raChild>]);
Constructor.
$sName is a name of the PPS.
$raTime1st, $raTime2nd is a array ref as ($iSec, $iMin, $iHour, $iDay, $iMon, $iYear). Same deal as always:
$iSecmeans seconds$iMinmeans minutes$iHourmeans hours$iDaymeans day$iMonis month -1$iYearis year - 1900
$raChild is a array ref of children PPSs.
π OLE::Storage_Lite::PPS::File π
OLE::Storage_Lite::PPS::File has 3 method. Three of them. A trio. β¨
β new β
$oRoot = OLE::Storage_Lite::PPS::File->new($sName, $sData);
$sName is name of the PPS.
$sData is data of the PPS.
β newFile() β
$oRoot = OLE::Storage_Lite::PPS::File->newFile($sName, $sFile);
This function makes to use file handle for getting and storing data.
$sName is name of the PPS.
And now, the $sFile situation, which has options:
- If
$sFileis scalar, it assumes that is a filename. - If
$sFileis anIO::Handleobject, it uses that specified handle. - If
$sFileisundefor'', it uses temporary file.
CAUTION: Take care$sFilewill be updated by"append"method. So if you want to useIO::Handleand append a data to it, you should open the handle with"r+". Do not come crying to me later, bestie, I'm warning you now. π
β append() β
$oRoot = $oPps->append($sData);
appends specified data to that PPS.
$sData is appending data for that PPS.
π CAUTION π
A saved file with VBA (a.k.a Macros) by this module will not work correctly. However modules can get the same information from the file, the file occurs a error in application(Word, Excel ...). So like β read all you want, but if you save it with macros, it's giving broken. Not the slay we wanted. π¬
π DEPRECATED FEATURES π
Older version of "OLE::Storage_Lite" autovivified a scalar ref in the new() constructors into a scalar filehandle. This functionality is still there for backwards compatibility but it is highly recommended that you do not use it. Instead create a filehandle (scalar or otherwise) and pass that in. Old habits die hard but please, let them die. πͺ¦
π COPYRIGHT π
The OLE::Storage_Lite module is Copyright (c) 2000,2001 Kawai Takanori. Japan. All rights reserved.
You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
π«Ά ACKNOWLEDGEMENTS π«Ά
First of all, I would like to acknowledge to Martin Schwartz and his module OLE::Storage. Giving credit where credit is due, as one always should. π
π AUTHOR π
Kawai Takanori kwitknr@cpan.org
This module is currently maintained by John McNamara jmcnamara@cpan.org
π₯ SEE ALSO π₯
OLE::Storage- Documentation for the OLE Compound document has been released by Microsoft under the Open Specification Promise. See
http://www.microsoft.com/interop/docs/supportingtechnologies.mspx - The Digital Imaging Group have also detailed the OLE format in the JPEG2000 specification: see Appendix A of
http://www.i3a.org/pdf/wg1n1017.pdf
and that's the whole page, bestie β perl v5.42.0, dated 2026-01-17, and that's a wrap. read it, love it, go read your OLE files responsibly. mwah. π
β¨
π¦ where this page comes from
- fedora 44: perl-OLE-Storage_Lite 0.24-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms