in reply to Re: Re: Re: Where's the result??? (problem with Win32::OLE)
in thread Where's the result??? (problem with Win32::OLE)

jand, is there I way I can up your guru score? Again, I had to pass:
my $keys = Variant(VT_BYREF|VT_VARIANT, 0);
But that did it! I'm ecstatic to have a solution, but I don't fully understand it... what was wrong with using VT_ARRAY? I don't quite get the Dim function, nor why the array is mulitdimensional (or appears to be... we're going from [0][0] .. [0][1]?). I've probably harassed jand enough... can anyone pose an explanation?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Where's the result??? (problem with Win32::OLE)
by jand (Friar) on Mar 27, 2003 at 22:24 UTC
    You are probably using an older version of Win32::OLE if you have to provide the second argument to Variant() in this case.

    The Dim() method returns a list of array bounds. Each element of the list is an array ref to a 2 element array containing the lower and the upper bound of that dimension. Although SAFEARRAYs typically have a lower bound of 0, this is not always true.

    So by iterating from $dim[0][0] .. $dim[0][1] we go from the lower to the upper bound of the first dimension of the underlying SAFEARRAY. Ideally, you should check that the returned VARIANT is actually an array, and that the @dim array only contains a single element.