Created
March 20, 2013 13:46
-
-
Save pmichaud/5204740 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pmichaud@kiwi:~/p6/rakudo$ cat R.setting | |
sub restricted($what) { | |
die "$what is disallowed in restricted setting" | |
} | |
sub open(|) { restricted('open') } | |
sub unlink(|) { restricted('unlink') } | |
sub shell(|) { restricted('shell') } | |
sub run(|) { restricted('run') } | |
sub QX(|) { restricted('qx, qqx') } | |
sub mkdir(|) { restricted('mkdir') } | |
sub rmdir(|) { restricted('rmdir') } | |
sub rename(|) { restricted('rename') } | |
sub copy(|) { restricted('copy') } | |
my class RESTRICTED is Mu { | |
method new { restricted(self.^name) } | |
method gist { restricted(self.^name) } | |
} | |
my class IO is RESTRICTED { } | |
my class IO::Socket is RESTRICTED { } | |
pmichaud@kiwi:~/p6/rakudo$ ./perl6 --setting=R | |
> say IO | |
IO is disallowed in restricted setting | |
in sub restricted at R.setting:2 | |
in method gist at R.setting:17 | |
> say IO::Socket | |
IO::Socket is disallowed in restricted setting | |
in sub restricted at R.setting:2 | |
in method gist at R.setting:17 | |
> say IO.new | |
IO is disallowed in restricted setting | |
in sub restricted at R.setting:2 | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment