On Wed, 10 May 2000 13:49:07 -0400, "Lowery, Thomas"
<[EMAIL PROTECTED]> wrote:
>>
>> my $row = [ map { $rs->Fields($_->{Name})->{Value} } @$ado_fields ];
>> foreach (@$row) {
>> $_ = $_->As(VT_BSTR) if UNIVERSAL::isa($_,
>> 'Win32::OLE::Variant');
>> }
>
>Would you jot a easy description of what this is doing? (mine) The array
>(reference) is looped looking for a blessed type of 'Win32::OLE...', if
>found replace with Convert to OLE String???
You got it! It converts first to an OLE string and then (by default
rules) to a Perl string).
>Is the As method part of the Win32::OLE::Variant class?
Yes.
>> Could you benchmark this and report if the effect is noticeable?
>Sure.
>Without extra foreach
>100 loops of other code took:20 wallclock secs (10.67 usr + 2.37 sys =
>13.05 CPU) @ 7.66/s (n=100)
>With
>100 loops of other code took:21 wallclock secs (10.53 usr + 2.98 sys =
>13.51 CPU) @ 7.40/s (n=100)
Seems acceptable to me.
>> The advantage of the code above is that it is both backward
>> and forward
>> compatible (should we ever decide to return more Variant
>> types as objects;
>> VT_DECIMAL comes to mind here).
>
>Both backward and forward compatible is ideal. So where do I find out more
>about the "Variant" type of data?
Did you read the Win32::OLE::Variant docs? Either in the HTML help tree,
using perldoc or by peeking into the .pm file?
As you are using 0.12, you can also look into my Perl Journal article,
which contains a section about variants too. It is in TPJ.pod.
-Jan
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]