Win32ole - VARIANT creation question


(Hynek Rostinsky) #1

Yet, I haven’t found how to do this in Ruby(Script):

<%@ ENABLESESSIONSTATE=FALSE LANGUAGE=PerlScript %>

<%
use Win32::OLE::Variant;

$Response->{ContentType} = ‘image/gif’;
my $filename = $Server->MapPath(‘Under_construction.gif’);
my $buf;
open ( FILE, $filename );
read ( FILE, $buf, 10000 );
close FILE;

This converts to a variant unicode value

my $variant = Win32::OLE::Variant->new( VT_UI1, $buf );
$Response->BinaryWrite($variant);
%>

The problem is in VARIANT creation - is this supported in win32ole ?
(The second question would be how to create/read ‘structured’ (VT_ARRAY)
variants.)
Have I missed something ? Thanks.

···

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Hynek Rostinsky
e-mail: hynek.rostinsky@foresta.cz, ICQ: 96558085, jabber:
hynek@njs.netlab.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


(Masaki Suketa) #2

No, but Win32OLE has WIN32OLE#_invoke method.
If you have the dispatch ID of BinaryWrite, then you can write:

$Response._invoke(dispid, [$buf], [VT_UI1])

For more information, see sample/olegen.rb and sample/xml.rb comming
with Win32OLE.

Hope this helps.

Regards,
Masaki Suketa

···

In message “win32ole - VARIANT creation question” on 02/06/26, “Hynek Rostinsky” hynek.rostinsky@foresta.cz writes:

This converts to a variant unicode value

my $variant = Win32::OLE::Variant->new( VT_UI1, $buf );
$Response->BinaryWrite($variant);
%>

The problem is in VARIANT creation - is this supported in win32ole ?