On Wed, 09 Jan 2008, Michael Ellery wrote:
> just running some quick COM code in perl and I notice this: if I call
> a property or method that returns VT_I4, Win32::OLE maps that to a
> perl integer in scalar context. When I call a property or method that
> returns VT_INT, however, it gets mapped to a perl string. Is this
> deliberate? Is it correct behavior? I can work around my current issue
> by just doing int() around my values, but it seemed strange to me that
> these two cases produced slightly different scalars.

It is a bug in Win32::OLE: it doesn't handle VT_INT (nor VT_UINT)
explicitly and therefore tries to coerce it into VT_BSTR (using
VariantChangeTypeEx) before turning it into a Perl scalar. At the Perl
level this shouldn't really matter though, as strings are converted back
to integers/numbers automatically whenever needed.

I don't know why it was never handled explicitly; I just checked, and
even the wtypes.h from VC98 lists VT_INT as a valid type for a VARIANT.

I'll fix it in a future Win32::OLE release.

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to