Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello Monks,

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?


In reply to Subset of Perl language by wanna_code_perl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-20 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found