http://qs321.pair.com?node_id=1108138


in reply to Replacing builtin macro languages with perl -- how difficult?

It really depends on the structure of the existing software. But I don't think it'd be a trivial undertaking in even the best of cases. However, it isn't hard to setup a little environment and play with embedding Perl. Check out perlembed.

  • Comment on Re: Replacing builtin macro languages with perl -- how difficult?

Replies are listed 'Best First'.
Re^2: Replacing builtin macro languages with perl -- how difficult?
by Anonymous Monk on Nov 23, 2014 at 21:15 UTC
    Thanks, but this is actually worse than piping to and from a perl process. It looks perlembed passes everything via command line arguments wrapped in a C function call. The Java program I'm working with has a macro language that probably calls Java library routines to do various things. I want Perl to do the same thing as well as seeing the underlying data if I want to take advantage of a perl library. There doesn't seem to be a way for perl to discover or act on the Java program's data. Hacking together interpreters across languages is something I haven't done. Sorry if I wasn't clear on this.

      The examples in that page are toys, but show the way to do what you want. Consider again Calling Perl from C. You don't have to restart Perl every time as in the example, just leave it there and call into it any number of times passing in data to operate on as you like.

      But maybe you're not really thinking of having Perl available inline and callable like that. If you just want to access Java from your Perl code, take a look at Inline::Java where you can write bridge code in Java that make whatever you want available to your Perl modules.