Run Perl in the browser with WebPerl!

View the Project on GitHub haukex/webperl

[ Using - Building - 🦋 - Notes - Legal - Wiki ]

Misc. Notes on WebPerl

Other places I’ve written about WebPerl:


DOI 10.5281/zenodo.1400490

“In the Press”

Prior Art

Several people have built microperl with Emscripten:


  1. Testing

    • How to best disable individual tests that we know won’t work? (qx etc.)
    • How to handle the many tests that call an external Perl?
      • patching t/test.pl’s runperl() seems easiest at the moment, and we can use the iframe method from the IDE
    • Continue work on WebPerl.t
      • More tests for Unicode support (Perl/JS interface, Perl.eval(), plus Emscripten’s virtual FS)
    • Focus on getting the tests running in the browser instead of node.js
    • How to best package tests?
      • If possible, a separate bundle, so that it can be loaded optionally and we don’t need to rebuild
      • How does make test find and handle all the various modules’ ts?
  2. Misc

    • Write up a full RPC example
    • Future
      • Would Future::AsyncAwait work in WebPerl? (Or maybe with a JS backend?)
      • Future::HTTP (probably just as a frontend to XHR?)
    • Improve Perl 6 integration
    • Investigate Emscripten’s main loop concept for handling nonblocking sockets?
    • Use Multiplicity for re-starting perl? (Thanks to Nick Clark for the idea)
    • Add Regex::Debugger into regex tester? (Thanks to Renee for the idea)
    • Turn some patches from emperl5 into patches for P5P
    • Submit some patches to Emscripten
    • Add Perl.Util functions for making file uploads and downloads easier
      • Plus an example showing how to use it to run a “legacy” Perl script with inputs and output
    • There is some potential for restructuring:
      • Perl.glue() and Perl.dispatch() could go into WebPerl.xs (?)
      • Parts of webperl.js could go into common_preamble.js or WebPerl.xs, so that emperl.js is runnable on its own in a Web Worker (?) (see notes in perlrunner.html / e12f1aa25a000) → this might be interesting for running tests?!
      • nodeperl_dev_prerun.js could probably be merged into that as well
    • Could put a WebPerl stub on CPAN
      • In theory could write a WebPerl::Local that contains the WebPerl API, and have various drivers such as WebPerl::WebDriver or WebPerl::JSAny that runs the code given to WebPerl’s js()
    • Regarding the funky syntax highlighting on GitHub: https://github.com/atom/language-html/issues/88#issuecomment-431361414
  3. See Also


$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt
Common Name (e.g. server FQDN or YOUR name) []: localhost
$ plackup --enable-ssl --ssl-key-file=selfsigned.key --ssl-cert-file=selfsigned.crt web/webperl.psgi
# then go to https://localhost:5000 and accept the certificate warning

Possible Improvements


Release Checklist

Copyright (c) 2018 Hauke Daempfling (haukex@zero-g.net) at the Leibniz Institute of Freshwater Ecology and Inland Fisheries (IGB), Berlin, Germany, http://www.igb-berlin.de

Please see the “Legal” page for details.

You can find the source for this page at https://github.com/haukex/webperl/blob/gh-pages/notes.md