in reply to How to get the CLSID with OLE::Storage?

As per the docs, if you're sure you've got a scalar property, call the string method on it:

use OLE::Storage::Property; use strict; my $clsid = $Doc->clsid($pps); die "not a scalar property" unless is_scalar($clsid); print "CLSID => ".$clsid->string."\n";
Is that what you're looking for?

-David

Replies are listed 'Best First'.
Re^2: How to get the CLSID with OLE::Storage?
by bontchev (Sexton) on Nov 10, 2007 at 11:59 UTC
    > Is that what you're looking for?

    Not quite but your message suggested to me what the proper solution is, thanks. The solution is to apply the string() method to the CLSID returned by the package:

    print $Doc->clsid($pps)->string()

    works perfectly.

    Regards, Vesselin

      Interestingly, OLE::Storage does something bizarre with the byte endianness of the CLSID... For instance, in one document the CLSID of the root storage consists of the following byte sequence:

      D8 F4 50 30 B5 98 CF 11 BB 82 00 AA 00 BD CE 0B

      (I can see it with a hex editor.) For this, $Doc->clsid($pps)->string() returns

      3050F4D8-98B5-11CF-BB82-00AA00BDCE0B

      In other words, it has assumed that the CLSID consists of a little-endinan DWORD, little-endian WORD, little-endian WORD, big-endian WORD, and 6 bytes (or is it 3 big-endian WORDs?). This is a bug, IMHO. The CLSID is just a sequence of 16 bytes (no endinanness) and should be returned as such.

      Regards,
      Vesselin

      print $Doc->clsid($pps)->string()
      Err, that's exactly the same as what I wrote. :-)

      -David