Hi Kevin,
Thanks for the quick response. And of course it works. I thought I had tried
this too but just went back and discovered I had transposed @$ to $@ (when
converting the array) and of course another error due to a careless mistake.
That's what happens when you look at something too long. Anyway, I'm back in
business and appreciate the help.
Have a great day,
Sturdy
________________________________
From: Kevin Godden [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 12, 2007 11:22 AM
To: [EMAIL PROTECTED]
Subject: Re: Need OLE COM/Variant help
Hi,
This worked for me for an [out, retval] VARIANT* when the returned
array contained strings:
# Get a list of the barcodes, this returns an OLE
# array which is used slightly differently from normal
# Perl arrays.
my $arr = $fis->GetCurrentBarcodes();
# Convert the returned OLE Array
# into a normal Perl array for ease
# of use.
my @barcodes = @$arr;
# Get the number of elements in the array.
my $barcode_count = @barcodes;
print "There are $barcode_count barcodes\n";
# Loop through the array and print out
# each barcode.
foreach my $barcode (@barcodes)
{
print "$barcode\n"
}
It is really hard to find out how to use COM properly from Perl,
there are very few example out there!
I hope this helps....
Kevin.
[EMAIL PROTECTED] wrote:
Hi List,
I am using Win32::OLE to access a custom COM interface
(Secure FTP Server by GlobalSCAPE). Mostly I have been
successful
after much reading, experimentation and gnashing of teeth
but
how to retrieve a VARIANT array totally escapes me. The only
interface
description I have is this IDL:
Returns an array of allowed IP masks.
HRESULT GetAllowedMasks([out,retval] VARIANT *aMasks);
The array aMasks may be any size and (I assume) contains
VT_BSTR elements such as 'nnn.nnn.nnn.nnn-nnn' where
any or all octets may contain a range separated by a hyphen.
I can instantiate the server object and do good things with
simple
data types such as VT_BSTR and VT_BOOL :
# For example, this will add an IP mask:
$ServerObj = Win32::OLE->new( 'COMInterface.CIServer');
my $bstrMask = Win32::OLE->Variant->(VT_BSTR,
'111.112.113.114-119');
my $boolTrue = Win32::OLE->Variant->(VT_BOOL, 1);
$ServerObj ->AddIPAccessRule($bstrMask,$boolTrue);
$ServerObj ->ApplyuChanges();
$ServerObj ->close();
But I have been totally unsuccessful in retrieving the array
containing the
IP Masks.
At this point I'm not even sure what the code should look
like, arrrgh.
Unfortunately,
there is a lot of the Win32::OLE doc that is over my head!
Any help,
examples,
links, etc. will really be appreciated.
Best regards,
Sturdy
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs
________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer.
Try it now
<http://uk.answers.yahoo.com/;_ylc=X3oDMTEydmViNG02BF9TAzIxMTQ3MTcxOTAEc2VjA
21haWwEc2xrA3RhZ2xpbmU> .
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs