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

This isn't exactly Perl Specific, as it could likely be applied to any interpreter for any language. But anyway...

I was wondering if anyone might have had experience or know of a way to embed a Perl interpreter into another program. Right now, I have a Program that uses a Perl plugin to run scripts. But the way you use the program involves downloading a seperate Perl interpreter that you point the plugin at. Not only is this not exactly user friendly, but also involves launching the interpreter repeatedly instead of keeping it in memory. So, I was wondering if any of you Gurus out there might have any suggestions.

Such as if there are any specific Interpreters/dlls (Yes it is a Windoze program) out there that might help. I did not actually write the program, but can get the guy who did. I believe it was written in Delphi (although it shouldn't matter as far as whether or not this is possible)
  • Comment on Embedding a Perl Interpreter Into another program

Replies are listed 'Best First'.
Re: Embedding a Perl Interpreter Into another program
by John M. Dlugosz (Monsignor) on Aug 03, 2001 at 20:36 UTC
    I've done that. Later perl's make it even easier. Start with the perlembed man page, for "how to embed perl in your C program".
      Thanks, I'll look into that. I might have to get the program translated from Delphi to C though. ;) As it apparentlly just includes the perl header files and goes from there.
        Perl itself exists as a DLL (I assume Windows since you said Delphi). The perl.exe we all know just loads that and calls it. You can load that DLL yourself. In C++ it's easy to override specific functions like what print() does, to work within your system. But you could start by seeing what's in that DLL and go from there.

        Ahh, I just found the part about active state's runtime. This may be just what I am looking for. :D

        UPDATE: Apparentally the FAQ is missing from perl.com, and the author of it is also MIA. Grrrr....