App::EvalServerAdvanced::Sandbox::Internal
This is an internal class used as part of the plugin system for the sandbox. This is where all the plugin roles for the sandbox end up.
sub run_perl { my( $class, $lang, $code ) = @_; ... }
The first argument $class is pretty much useless. It will always be App::EvalServerAdvanced::Sandbox::Internal, as your subroutine is called as a dynamic method call.
$class
In the configuration you can setup the language thusly,
[language.perl] sub="deparse_perl" seccomp_profile="lang_perl"
That subroutine, deparse_perl, will then be called and told the name of the language, and the code so you can do whatever processing is needed.
deparse_perl
You can also use this to template the code being passed to an external interpreter.
sub perl_wrap { my ($class, $lang, $code) = @_; my $qcode = quotemeta $code; my $wrapper = 'use Data::Dumper; local $Data::Dumper::Terse = 1; local $Data::Dumper::Quotekeys = 0; local $Data::Dumper::Indent = 0; local $Data::Dumper::Useqq = 1; my $val = eval "#line 1 \"(IRC)\"\n'.$qcode.'"; if ($@) { print $@; } else { $val = ref($val) ? Dumper ($val) : "".$val; print " ",$val; } '; return $wrapper; }
And in the configuration of the EvalServer
[language."perl5.8"] bin="/perl5/perlbrew/perls-5.8.9/bin/perl" args=["-e", "%CODE%"] wrap_code="perl_wrap" seccomp_profile="lang_perl"
This lets you manipulate the code before it's passed to the interpreter and make any changes necessary.
Ryan Voots <simcop@cpan.org>
To install App::EvalServerAdvanced, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::EvalServerAdvanced
CPAN shell
perl -MCPAN -e shell install App::EvalServerAdvanced
For more information on module installation, please visit the detailed CPAN module installation guide.