Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi Monks I am working with a windows application that has a COM interface library. I have some example Jscript that runs that I am now converting into Perl. So the Jscript looks something like this:

var server = new ActiveXObject("DataServer.Access"); var data = server.Object.Item var tool = new ActiveXObject("ToolServer.Tool"); findResult(data,tool); function findResult(data,tool) { tool.Clear; tool.Data = data; ... }
This is my interpretation of this in Perl:

#!/usr/bin/perl -w use strict; use Win32::OLE; use Dumpvalue; my $dumpvalue = Dumpvalue->new; my $server = Win32::OLE->new('DataServer.Access'); my $data = server->Object->Item; my $tool = Win32::OLE->new('ToolServer.Tool'); $tool->clear; $tool->Data = $data; $dumpvalue->dumpValue(\$tool);
Its the second last line that I don't understand. If I understand what I am supposed to do, the $tool object needs to have the Data attribute populated with the $data object. When I dump $data and $tool, I see hashes populated with data. For instance in $tool I can see:

'Completed' => 0 'Error' => '' 'Data' => undef 'Results' => Win32::OLE=HASH(0x209d2f4) 'Count' => 0 'Item' => undef 'Settings' => Win32::OLE=HASH(0x2098ae4) ...
and so on. So in this hash you can see that 'Data' => undef - I would like it set to $data.

I have looked the the documentation for Win32::OLE and I'm simply not clear on what the syntactic sugar is that I need to assign the $data instance to the $tool->Data attribute. What I have shown typically throws the following warning: Win32::OLE(0.1707) error 0x80020003: "Member not found" in PROPERTYPUTREF "data" at line 12

I've tried variations on assigning the $data instance to $tool->Data,including

$tool->Data = $data; $tool{Data} = $data; $tool{'Data'} = $data; $tool{'Data'} = $$data;
and so on.

I'm also open to any suggestions on what to try next. I'm also interested in finding out anything that that would allow me to observe the contents of the Jscript variables so I could better understand what is being passed there and where it is going.


yet another biologist hacking perl....

In reply to Working with COM objects by MadraghRua

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (4)
    As of 2019-02-17 11:22 GMT
    Find Nodes?
      Voting Booth?
      I use postfix dereferencing ...

      Results (96 votes). Check out past polls.