in reply to Re: Running user-provided JavaScript code
in thread Running user-provided JavaScript code

It's a different problem entirely, i'm afraid, although the solution is somewhat related. The JS is is designed to run in a sandbox, something that would be very hard to pull off with Perl. You'd basically have to run some sort of virtualization (KVM, Virtualbox, Containers, etc) for every single script that not only allows you to limit file access but also network access. Now image you have hundreds or even thousands of scripts that need to run every few minutes.

One of the reasons i'm playing around with Duktape is for my XPD project: XPD - Do more with your PerlMonks XP. Basically, i want to enable the users to create "smart contracts". Those could, for example, buy or bid on NFTs and then try to resell them at a profit. So they would have to run every so often for a very short amount of time, just to check the market and make any decision based on that. If i would use Perl, i'd be constantly starting and stopping Containers or Virtualboxes. But with a language interpreter that's designed to be a sandbox, all i'd be doing is loading scripts.

You might be able to pull this of with Perl if you have enough hardware resources. But i'm not Jeff Bezos with my own data centers. I own a single 10 year old quad core server, so i'm somewhat more limited in my choices.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'