http://www.perlmonks.org?node_id=765728


in reply to Working with COM objects

Alright, I had a deeper look into Win32::OLE and came across the following

$tool->LetProperty('Molecule',$data); $tool->setProperty('Molecule, $data);
So it turns out that the LetProperty method loads the $data instance into the Molecule attribute of the $tool instance. I'll be looking more closely at this to understand why this worked over the previous syntactic sugars that i was using.

I hope this node helps someone else in the future

MadraghRua
yet another biologist hacking perl....

Replies are listed 'Best First'.
Re^2: Working with COM objects
by Anonymous Monk on May 23, 2009 at 07:21 UTC

    In Win32::OLE property assignment using the hash syntax is equivalent to the Visual Basic Set syntax (by reference assignment):

            $Object->{Property} = $OtherObject;

    corresponds to this Visual Basic statement:

            Set Object.Property = OtherObject

    To get the by value treatment of the Visual Basic Let statement

            Object.Property = OtherObject

    you have to use the LetProperty() object method in Perl:

            $Object->LetProperty($Property, $OtherObject);

    LetProperty() also supports optional arguments for the property assignment. See OBJECT->SetProperty(NAME,ARGS,VALUE) for details.