Re: properties, VT types, and Win32::OLE

2008-02-04 Thread Michael Ellery
Jan Dubois wrote:
> On Mon, 04 Feb 2008, Michael Ellery wrote:
>> Given some object and a property:
>>
>> my $obj = new Win32::OLE("SOME.class");
>> my $val = $obj->{SomeProperty};
>>
>> ...is there some way to determine the VT type of $val (or of
>> SomeProperty, equivalently). I often run into strange problems where I
>> expect a 32 bit negative value from some property, but when I simply
>> print it, perl shows it as a large positive value. It is bit
>> equivalent to the expected negative value, but somehow not being
>> interpreted with the corrected sign-ed-ness. The first thing I would
>> like to check is the VT type that Win32::OLE thought it got -- then
>> I'll see if I agree with how Win32::OLE is converting to perl scalars
>> based on the VT type.
> 
> I haven't tested this, but you should be able to do something like this:
> 
> my $prop = Win32::OLE::Variant->new();
> $obj->Dispatch('SomeProperty', $prop);
> print "V_VT(prop)=%d\n, $prop->Type);
> 

With two minor syntax fixes to the print line, this works great. Thanks!

-Mike

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


RE: properties, VT types, and Win32::OLE

2008-02-04 Thread Jan Dubois
On Mon, 04 Feb 2008, Michael Ellery wrote:
> Given some object and a property:
>
> my $obj = new Win32::OLE("SOME.class");
> my $val = $obj->{SomeProperty};
>
> ...is there some way to determine the VT type of $val (or of
> SomeProperty, equivalently). I often run into strange problems where I
> expect a 32 bit negative value from some property, but when I simply
> print it, perl shows it as a large positive value. It is bit
> equivalent to the expected negative value, but somehow not being
> interpreted with the corrected sign-ed-ness. The first thing I would
> like to check is the VT type that Win32::OLE thought it got -- then
> I'll see if I agree with how Win32::OLE is converting to perl scalars
> based on the VT type.

I haven't tested this, but you should be able to do something like this:

my $prop = Win32::OLE::Variant->new();
$obj->Dispatch('SomeProperty', $prop);
print "V_VT(prop)=%d\n, $prop->Type);

Cheers,
-Jan

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


properties, VT types, and Win32::OLE

2008-02-04 Thread Michael Ellery
Given some object and a property:

my $obj = new Win32::OLE("SOME.class");
my $val = $obj->{SomeProperty};

...is there some way to determine the VT type of $val (or of
SomeProperty, equivalently).  I often run into strange problems where I
expect a 32 bit negative value from some property, but when I simply
print it, perl shows it as a large positive value.  It is bit equivalent
to the expected negative value, but somehow not being interpreted with
the corrected sign-ed-ness.  The first thing I would like to check is
the VT type that Win32::OLE thought it got -- then I'll see if I agree
with how Win32::OLE is converting to perl scalars based on the VT type.

Advice appreciated.

-Mike Ellery

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