chinman has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know if and how Perl can be used as an OLE automation server, e.g. other client applications such as Excel can control a Perl executable. I see it is possible to use Perl as the client with Win32::OLE...but not as the server. Any help would be appreciated.

Replies are listed 'Best First'.
Re: OLE automation server
by iakobski (Pilgrim) on Jun 12, 2001 at 12:35 UTC
    Yes, you can build a COM/ActiveX server using ActiveState's PerlCtrl, in the Dev Kit. I have used this for turning Perl modules into COM objects that can be accessed from VB. It does a remarkably good job of converting the COM datatypes into Perl's scalars, hashes and lists.

    There are a few quirks, and I suggest starting with a hello, world and moving on in short steps. The only downside is that the DLL starts at around 1Mb for the simplest object.

    -- iakobski

      Yeah, it is great!

      The DLL size can be as small as 20k if you don't go for a freestanding DLL. You only need the freestanding DLL if perl isn't installed on the target computer.

      $code or die
      $ perldoc perldoc
Re: OLE automation server
by John M. Dlugosz (Monsignor) on Jun 11, 2001 at 22:29 UTC
    I have not tried this, but I've thought about using "script components" with PerlScript. Bascically, this will run your script as a server, and it works with any scripting language installed as an ActiveX Scripting Engine.

    Also, ActiveState sells something for that in their DevKit.