I have a GUI I made with Perl/TK ( http://www.lightandmatter.com/ogr/ogr.html ). I would like to add some hooks so that users can define certain custom computations that they want to happen in certain situations. These are basically going to be simple arithmetic operations, e.g., the one I need for my own use right now is that in a certain place, I need a number to get divided by 10. I was thinking that rather than having users modify the perl code themselves, or hot-plug perl code for this purpose, it might be more reasonable to use an extension language such as Scheme, Lua, or JS. Can anyone suggest how to do this?
The method that occurs to me is to shell out to an interpreter that reads the function's input from stdin and writes the output to stdout. This is probably the most ridiculously inefficient method ever devised to divide a variable by 10, but in my actual use case the performance hit might be undetectable to the person (me) using the GUI. Shelling out is not a security problem because this is a client-side GUI app, not a web app. But is there a nicer way to do this?
I'm not sure what language is most appropriate. Realistically I think I'm the only person who will probably ever use this functionality, and I think it would be fun to play with a lisp. But if someone else was going to use it, they might appreciate a langauge with infix notation such as Lua or JS.
I would like to avoid adding any dependency that isn't available as a debian package, so I guess that leaves out . I definitely don't want to have to build a custom perl interpreter with a Guile library linked in.
After I wrote this, further googling turned up Inline::Guile, but there are indications that it might not actually work -- I'll have to test it. Found this thread: Is there a way to call lisp from perl?, but I'm not seeing anything in there that immediately seems to meet my criteria.
Thanks in advance for any suggestions!
In reply to Extending a perl program with Scheme, Lua, or JS by bcrowell2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |