Re: Need OLE COM/Variant help

2007-04-12 Thread Bill Luebkert
[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. 

You're probably going to need a 'by reference' variant, but Jan's the
expert here and may pick up on your post.  Maybe something like
VT_VARIANT|VT_BYREF or VT_ARRAY|VT_VARIANT|VT_BYREF will do what you
need.  I just don't have the experience with variants to give an exact
answer.

Variant.pm:

Variants by reference

Some OLE servers expect parameters passed by reference so that they
can be changed in the method call.  This allows methods to easily
return multiple values.  There is preliminary support for this in
the Win32::OLE::Variant module:

my $x = Variant(VT_I4|VT_BYREF, 0);
my $y = Variant(VT_I4|VT_BYREF, 0);
$Corel->GetSize($x, $y);
print "Size is $x by $y\n";

After the C method call C<$x> and C<$y> will be set to
the respective sizes.  They will still be variants.  In the print
statement the overloading converts them to string representation
automatically.

VT_BYREF is now supported for all variant types (including SAFEARRAYs).
It can also be used to pass an OLE object by reference:

my $Results = $App->CreateResultsObject;
$Object->Method(Variant(VT_DISPATCH|VT_BYREF, $Results));
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: filefield...Solution number 7: UPDATE

2007-04-12 Thread Bill Luebkert
Jerry Kassebaum wrote:
> I wrote back to the guys at my server, asking what they did to solve the 
> problem. The actual solution was that they added this line, right under the 
> shebang line:
> 
> $CGITempFile::TMPDIRECTORY = '/users/web/kass/web/dns/tmp';

You could also have just done a mkdir './tmp' if ./tmp doesn't exist
(you're probably sitting in your cgi-bin dir) and used 'tmp' or './tmp'
for your tmp dir and then set $ENV{TMPDIR} to wherever that is.

 From CGI.pm docs:

To ensure that the temporary file cannot be read by other CGI scripts,
use suEXEC or a CGI wrapper program to run your script.  The temporary
file is created with mode 0600 (neither world nor group readable).

The temporary directory is selected using the following algorithm:

 1. if the current user (e.g. "nobody") has a directory named
 "tmp" in its home directory, use that (Unix systems only).

 2. if the environment variable TMPDIR exists, use the location
 indicated.

 3. Otherwise try the locations /usr/tmp, /var/tmp, C:\temp,
 /tmp, /temp, ::Temporary Items, and \WWW_ROOT.

Each of these locations is checked that it is a directory and is
writable.  If not, the algorithm tries the next choice.
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: Need OLE COM/Variant help

2007-04-12 Thread robert . w . sturdevant
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
 .

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: Need OLE COM/Variant help

2007-04-12 Thread mark pryor
Robert,

its easy once you use the right Win32::OLE support module :)

check out this WMI sample that shows how to allocate for an 8204 array.
http://www.techiegroups.com/showthread.php?t=48703

Here's an object browser for scripting (by me) to help see the properties and 
methods
http://www.tlviewer.org/tlviewer/

-- 
Mark

[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


   
-
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Need OLE COM/Variant help

2007-04-12 Thread robert . w . sturdevant
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


Re: filefield...Solution number 7: UPDATE

2007-04-12 Thread Jerry Kassebaum
I wrote back to the guys at my server, asking what they did to solve the 
problem. The actual solution was that they added this line, right under the 
shebang line:

$CGITempFile::TMPDIRECTORY = '/users/web/kass/web/dns/tmp';

_
Mortgage refinance is Hot. *Terms. Get a 5.375%* fix rate. Check savings 
https://www2.nextag.com/goto.jsp?product=10035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2bbb&disc=y&vers=925&s=4056&p=5117

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: filefield...Solution number 7

2007-04-12 Thread Jerry Kassebaum

>Things to look at or try:

7)  This is from a rep at my server:


"Hi Jerry,

Thank you for contacting us.

We have found the problem and we have fixed it for you. Kindly check it.

Thank you."



Thanks for your help, Bill!! It is working. If you upload a textfile to 
http://biblescramble.com/dns/textAreaLuebkert.cgi its contents will be 
printed out on the next page.

_
Need a break? Find your escape route with Live Search Maps. 
http://maps.live.com/?icid=hmtag3

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: filefield

2007-04-12 Thread Bill Luebkert
Jerry Kassebaum wrote:
> 
> I tried
> 
> my $tmpdir = "/tmp";
> 
> and
> 
> my $tmpdir = $ENV{TEMP} || "C:/tmp";
> 
> and
> 
> my $tmpdir = $ENV{TEMP} || "/tmp";
> 
> Same error: "Software error:
> 
> CGI open of tmpfile: Permission denied"

Things to look at or try:

1) What are the perms on /tmp ?

2) What user are you running as ?

3) Could you create a tmp dir under wherever you are running
and give it 0600 or 0644 perms and try using 'tmp' then
instead of '/tmp'.

4) If you have shell access, see if you can create a file in
/tmp and/or this new dir ./tmp .

5) What webserver are you using ?

6) Continue on in this vein until you figure out why you're
being denied permission to create the temp file.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs