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

Greetings Fellow Monks,

I am trying to build a tool to catalogue M$ Office documents in a spreadsheet, and I already know that it is tantamount to employing the Black Arts to attempt such a thing. The specific task I need to accomplish is to extract the "Title" property from the files -- this is a piece of meta-data that is somehow stored with each file. The tool that I have chosen is Martin Schwartz' seemingly excellent OLE::Storage modules. I say, "seemingly" because I have yet to get any of it to work, but from the documentation it appears to be capable of the task at hand.

The part I'm tripping over is this: the documentation refers throughout to properties (typically named $pps), but does not say how to generate a refence to such a thing.

It is clear how to get a handle to a document, as

my $Startup = new Startup; my $Var = OLE::Storage->NewVar(); my $Doc = OLE::Storage->open($Startup, $Var, $file);
which is pretty much verbatim from the documentation. Then I guess I would need to call a method on $Doc to read the properties structure from the document, perhaps as,
my @pps = $Doc->dirhandles(0);

The dirhandles method is documented as,

@pps == $D -> dirhandles ($pps)
so I'm assuming that $D may be the same as $Doc, and that the dirhandles method returns an array. Am I on the right track here?

I don't have the luxury of time to do trial and error with tese modules, so I'd really love to see some working example code, if such exists. The documentation refers to a couple of example scripts that come with the distribution, but these are LAOLA eamples, and don't use the OLE::Storage modules.

Thanks!

PCS

Replies are listed 'Best First'.
Re: Examples of OLE::Storage?
by Mr. Muskrat (Canon) on Nov 26, 2002 at 21:59 UTC

    Check out the ldat tool included with the module.
    It shows how to get the document properties.
    It uses OLE::Storage::Std module.

      I checked again, and noticed that there is a newer version of ldat than the one I have, and it uses the OLE::Storage modules. Thanks for the head's up!

      I got my version of OLE::Storage via ActiveState's ppm facility, and it didn't install the extras.

      PCS