Tips and Techniques
Here are a couple of tips for using OLE automation from Perl.
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";Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access