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

Hi

Is it possible to run WebPerl inside a PWA?

Hence effectively running Perl inside an app which can be installed on Android, Win, Linux?

Has it been attempted yet?

What are the results?

Does it reduce the startup time of Perl because it's running hot in the background?

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re: WebPerl in a Progressive Web App?
by haukex (Archbishop) on Mar 06, 2026 at 18:23 UTC
    Is it possible to run WebPerl inside a PWA?

    Without having the time to test this, but having written several PWAs myself, I think that this should work. The way PWAs work is that they have a "service worker" that can intercept requests to the server and can decide whether to respond with files from the local cache instead, thus enabling them to work offline too. So I think they should also be able to intercept and cache the requests to the WebPerl files. Here is one of the service workers I wrote and the resources on MDN you linked to are very good.

    Has it been attempted yet? What are the results? Does it reduce the startup time of Perl because it's running hot in the background?

    Sorry, I don't know the answers there :-( For the latter, a PWA alone doesn't automatically mean Perl keeps running in the background - one would have to fire up an interpreter in a Web Worker, independently of whether it's a PWA or not. I could imagine tiny speedups from the responses for the WebPerl files always coming from the local cache, and perhaps storing the uncompressed WebPerl resources instead of having to uncompress the gzipped server responses, but it's still those same megabytes that have to be passed around, so I have my doubts...

      > For the latter, a PWA alone doesn't automatically mean Perl keeps running in the background - one would have to fire up an interpreter in a Web Worker, independently of whether it's a PWA or not.

      my concerns were that a cold start of webperl implies

      • megabytes of web-perl environment need to be fetched from the net
      • time to start the compiler and compile the code.
      • getting the interpreter ready

      I was thinking of having a hot Perl server in at least a FastCgi'ish way in the WebWorker and communicating with the webpage. ( Prepared till the INIT phase)

      • I was hoping that this hot start is considerably faster.
      • That response is competing speed wise with pure JS code.
      • And that bigger memory overhead° can be handled by swapping dormant PWAs to disc.

      Please correct me if my assumptions were to naive...

      > but it's still those same megabytes that have to be passed around,

      I'm ignorant about the amount of megabytes needed in RAM.

      On a tangent: Did you try running Mojolicious inside WebPerl?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery

      °) tho I forgot how much RAM is needed then