Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Embedding Perl Everywhere

by rje (Deacon)
on Jul 30, 2012 at 20:39 UTC ( [id://984516] : perlquestion . print w/replies, xml ) Need Help??

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

Dear PerlMonks:

I would love to have a Perl interpreter embedded into -- nay, even compiled into -- my current job-required-runtime, be it in the browser, or in a foreign VM (yes, the JVM springs to mind, and even (whispering softly)... iOS).

I am tired of being forced to use an embedded JavaScript interpreter, or Groovy, or a one-off LISP variation, or Python, or whatnot, in order to script changing tasks and avoid compilation. I want Perl there!

Yes, I know, the rule is: if I want it, I should code it myself. I understand and agree. It just seems like this would be such a useful thing to have on so many "mini platforms" that surely somebody has ported Perl already.


Replies are listed 'Best First'.
Re: Embedding Perl Everywhere
by Corion (Patriarch) on Jul 30, 2012 at 20:51 UTC

    Perl can be embedded. See perlembed.

    (Not so) obviously, the really tricky part is exposing the innards of your application in a meaningful manner to the Perl interpreter, especially when the application itself is not written in Perl.

Re: Embedding Perl Everywhere
by pemungkah (Priest) on Jul 30, 2012 at 23:58 UTC
    For iOS, you might want to check into what the jailbreak community's done to see if you can get a working interpreter; if you want to build an app around Perl, remember that at present, Apple has only loosened the rules some on embedded interpreters, but has not eliminated them. The big restriction is that no downloaded code (except Javascript for a UIWebView) can be run in any interpreter in an iOS app. You have to include the interpreted code with the app as submitted for review, or have the user type their own code into the app. You may may run into trouble (i.e., your app will be rejected) if you try to allow sharing or saving of code into iCloud.
      Fascinating! I'll have to read that restriction... it has interesting implications. For example, an image file read from the 'web can (loosely) be considered to be 'interpreted' when it is decoded. (I.E. at what point is decoding == interpretation). I'll go see... thanks for that post! ++