Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
No such thing as a small change
 
PerlMonks  

Re: Avoiding Greenspun's Rule; scripting within Perl

by Rhandom (Curate)
on Mar 21, 2012 at 13:47 UTC ( #960775=note: print w/ replies, xml ) Need Help??


in reply to Avoiding Greenspun's Rule; scripting within Perl

Many projects I've been writing lately have included the ability to use Javascript via JavaScript::V8. It is cheap and it is blazingly fast and if you are a web shop then you most likely have a team that already speaks Javascript.

I'd like to use perl as an embeded language inside of perl, but I have yet to see a safe (Safe.pm) locked down environment. Javascript isn't perfect as they could still consume all memory, or write an infinite loop, but there is no danger of it having access to more than I give it.

my @a=qw(random brilliant braindead); print $a[rand(@a)];


Comment on Re: Avoiding Greenspun's Rule; scripting within Perl
Re^2: Avoiding Greenspun's Rule; scripting within Perl
by tobyink (Abbot) on Mar 22, 2012 at 14:20 UTC

    I've not used JavaScript::V8, but have used JavaScript::SpiderMonkey and JE (the latter of which is a pure Perl javascript implementation!) and find Javascript to be a good choice for this sort of thing.

    I have also taken a look at the various Perl Lua offerings (Inline::Lua, Outline::Lua, etc), but none of them have impressed me much. I can't seem to find a way to, for example, lock down Lua's file IO functions, so it doesn't seem to be useful as a sandbox. (It might be possible with Lua::API, but that module is very low level and I've not had much success with it.)

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://960775]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2014-04-21 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls