Hello, Lisp world! This is my first released Common Lisp code. Perl in Lisp is a Common Lisp interface to the Perl 5 API. It allows you to run a Perl interpreter embedded inside Lisp and evaluate Perl code. It does not require any C wrapper code — the API definitions are done with CFFI and the rest is pure ANSI Common Lisp.
In response to the obvious question, “Why on Earth would you want to do such a thing?” my best answer is “Why not?” I thought it would be fun. It ended up being more difficult than I expected — the Perl API is not for the faint of heart, nor for those unwilling to dig through source code. But it does work.
This was also an experiment to see if I could follow two “best practices” of software development — literate programming and unit testing — at the same time. It wasn’t always easy, and it tripled the amount of work I had to do, but the end result was definitely worth it. Thanks to the literate source, I understand what all of the code does. Thanks to the unit tests, I know that it works.
This is a beta release. It can evaluate strings of Perl code, call Perl functions, and convert between Lisp and Perl types. Callbacks from Perl to Lisp are not yet supported. Some Perl modules may not work, particularly if they depend on external C libraries.
See the project page for implementation compatibility notes, download links, and documentation.
Potentially, it could be very useful. CPAN has over ten thousand modules for doing all sorts of obscure things. Say you want to output an Excel spreadsheet from your CL application. Just use Spreadsheet::WriteExcel.
Jeremy Smith started a similar project for embedding Python: PythOnLisp.
[…] My friends, it was of today that I saw this article about something of the name Perl in Lisp. From my readings about it, it is of a tool that lets one imbed and run Perl in Lisp source codes! […]
Many thanks for this module, I am very pleased for it.
Does it have development plans? Mailing list?
I am willing to provide my albeit small amount of efforts to extend and improve the module.
As of current version, dynamic loading is not allowed (no DynaLoader).
I am succeeded in using dynamic loading, any chance for this feature to be added?
Thanks once again!
Vadim.