in reply to Best practice for user-input in eval

Well, there actually isn't any "good" solution to your problem. Perl is Turing-complete, and as such, you cannot prove that any perl code will run forever or end someday. Your best bet would be to run the code in some sort of virtual environment (chroot or whatever) with a time limit. Another option would be to create a language interpreter that would dramatically reduce the capabilities of the input code by allowing a very limited subset of Perl. The best would be combination of the two : write a "similiPerl" interpreter in Javascript and run it in the client browser, to avoid any unwanted effect on the server :)
  • Comment on Re: Best practice for user-input in eval

Replies are listed 'Best First'.
Re^2: Best practice for user-input in eval
by Anonymous Monk on Dec 03, 2008 at 13:48 UTC
    After you finish writing similiperl, you could just provide the user with a link to download perl on his own system.