I've recently translated some OLE code from vbs to perl and in most cases it went quite well. The following however I can't get working. vbs-code:
Dim pcbApp Set pcbApp = GetObject(, "MGCPCB.ExpeditionPCBApplication") Dim pcbDoc Set pcbDoc = pcbApp.ActiveDocument Dim key key = pcbDoc.Validate(0) Dim licenseServer Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Applicatio +n") Dim licenseToken licenseToken = licenseServer.GetToken(key) msgbox licenseToken
translated like this:
use strict; use warnings; use Win32::OLE; my $pcbApp; eval {$pcbApp = Win32::OLE->GetActiveObject('MGCPCB.ExpeditionPCBAppli +cation')}; die "Expedition not installed" if $@; die "Expedition not running" unless defined $pcbApp; my $pcbDoc = $pcbApp->ActiveDocument; die "No active document." unless $pcbDoc; my $key = $pcbDoc->Validate(0); my $licenseServer = Win32::OLE->new('MGCPCBAutomationLicensing.Applica +tion'); die "Automation license acquisition failed: " . Win32::OLE::LastError( +) unless defined $licenseServer;
The vbs code runs and displays the licenseToken at the end. The perl code fails with
Automation license acquisition failed: Win32::OLE(0.1709) error 0x8007 +007e: "The specified module could not be found"
Using 'CreateObject' instead of 'new' doen't change anything (from the docs I expect them to be equivalent). Any idea how to track down the source of this error?

Wolfram


In reply to Win32::OLE -- translation from vbs to pl by whumann

Title:
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, details, 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, summary, 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.