ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы.



19.5 Tips and Techniques

Here are a couple of tips for using OLE automation from Perl.

19.5.1 Translating Samples from Visual Basic

Finding documentation and examples that show you how to use an automation server from Perl can be difficult. You'll more likely find examples for Visual Basic. Converting automation examples from Visual Basic to Perl is quite easy.

Visual Basic also uses a CreateObject call to create automation objects. Visual Basic uses a set statement to assign an object, whereas Perl just needs a normal assignment. Visual Basic references properties and methods using the dot operator, while Perl uses the pointer arrow for methods, and the pointer arrow and a hash for properties. Here's a brief snippet from Visual Basic:

set Message = ActiveSession.Outbox.Messages.Add
Message.Subject = "Subject"
Message.Text = "Text"

And here's the translation into Perl:

$Message = $ActiveSession->Outbox->Messages->Add();
$Message->{Subject} = "Subject";
$Message->{Text} = "Text";