For a personal "fun" project I've had rattling around for a long time: is there any way (or are there any existing projects) to implement a subset of Perl? More to the point, I'm thinking about an educational game for grade school kids to learn some basic programming concepts without, you know, BASIC. I don't need a super-secure hack-proof system--it's not that important. Mainly I just want to limit the students' ability to shoot themselves (and each other) in the foot, and also limit their access to cheat by taking liberties with namespaces and object innards. Off the top of my head, I'd want to eliminate or limit:
- Filesystem access, pretty much all I/O except <> and the (s)print(f)/say family.
- system, exec, fork, ``, etc.
- IPC, including pipes, signals and sockets
- syscall, POSIX, ...
- Debugger, dump, deparse, tie, etc.
- Read-only @INC, probably just disable or whitelist require/use/no as well.
- package overrides, redefinitions (though I imagine _I_ will need to do a fair amount of that to accomplish many of the other goals on this list.
- BEGIN, END, INIT, ... (probably)
- Setting some perlvars
- ... just for starters.
I realize I'll at the very least need a custom Perl installation, with many core modules removed, stubbed, or overridden. I imagine there are some compile flags that would help as well. Students would not have the ability to run their code directly; it would be saved in a web-based editor and run by a harness of my creation (so default pragmas, overrides, source filters, etc., can be taken care of). To limit the performance hit from the inevitable runaway loops (despite best efforts to detect and kill them), as well as provide a bit of partitioning, I'm thinking of just keeping several lightweight VMs running with finite resource limits, which would serve requests round-robin.
I'm sure I haven't thought of everything (and it certainly doesn't need to be perfect), but with any luck I'm closer to over-thinking this than under-thinking. Thoughts? Existing projects I haven't been able to find?