John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

I know I can control MSOffice programs using Perl.

Is there a way to embed the Perl code inside the document, much as the VBA yucky code is?

—John

Replies are listed 'Best First'.
Re: Microsoft Word and Perl scripting
by davemabe (Monk) on Jul 26, 2001 at 00:13 UTC
      Yea, I can do that without buying anything extra by simply using WSC, too. I figured that's what I would be doing. But how do I store it inside the host file?
Re: Microsoft Word and Perl scripting
by rrwo (Friar) on Jul 27, 2001 at 06:14 UTC

    ActiveState's Perl has a PerlScript component that allows Perl to be used in place of VBScript or JScript. The documentation with it discusses how to use it.

    It's kind of unsafe to have on your system though. Imagine a web page with PerlScript that deleted your files? PerlScript (and VBScript or JScript) doesn't run in the "sandbox" that Java supposedly does.

      Yes, and I've written ASP with Perl. But how do I put such a program inside the Word document, like the supplied BASIC can do?

        Check the ActiveState Perl docs, and maybe do some research on the <acronym title="Microsoft Developer Network">MSDN</acronym> web site at http://msdn.microsoft.com/. Windows allows scripting engines to be plugged in, so one can use VBScript or JScript (Microsoft's JavaScript) in various applications. You should be able to do the same with Perl.

        Caveat: I've never done this, so I can't explain how to do it. But I believe it should be possible.