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::Root
  • OLE::Storage_Lite::PPS::File
  • OLE::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:

  • $iSec means seconds
  • $iMin means minutes
  • $iHour means hours
  • $iDay means day
  • $iMon is month -1
  • $iYear is 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:

  • $iSec means seconds
  • $iMin means minutes
  • $iHour means hours
  • $iDay means day
  • $iMon is month -1
  • $iYear is 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 $sFile is scalar, it assumes that is a filename.
  • If $sFile is an IO::Handle object, it uses that specified handle.
  • If $sFile is undef or '', it uses temporary file.
CAUTION: Take care $sFile will be updated by "append" method. So if you want to use IO::Handle and 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. πŸͺ¦


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 πŸ”₯


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