Embedding JavaScript in Perl

Gonzalo Diethelm — 20 minutes 🐪

How I embedded two JS engines (Duktape and V8) in Perl using XS, and how we are using that to migrate our web frontend to modern JS-based frameworks.

Some of our web apps are built with a traditional Perl backend, serving (mostly) static front-end web pages. We have wanted for a long time to move to a more modern JavaScript architecture, that would allow for single-page browser applications, but also keeping the ability to do server-side rendering. The best of all worlds for us was finding a way of creating page templates in a modern JavaScript framework (React, Vue, etc.) and running those both on the browser and on the server. Of course, the challenge for THAT was migrating all of our backend out of Perl, a very time consuming and expensive proposition. Then the crazy idea hit... What if we could teach Perl how to deal with the JavaScript templates itself? Enter JavaScript::Duktape::XS and JavaScript::V8::XS.



Talk tags
JavaScript, Duktape, V8, embedding
Perl versions
🐪 Perl 5
Target audience
Intermediate
Category
Perl 5 programming
Talk duration
20 minutes
Talk status
accepted
Related links

https://metacpan.org/pod/JavaScript::Duktape::XS

https://metacpan.org/pod/JavaScript::V8::XS

Photo

Talk announce