+# For PLPsafe scripts
+sub safe_eval {
+ my ($r, $code) = @_;
+ $r->send_http_header('text/plain');
+ require Safe;
+ unless ($PLP::safe) {
+ $PLP::safe = Safe->new('PLP::Script');
+ for ( map split, $r->dir_config->get('PLPsafe_module') ) {
+ $PLP::safe->share('*' . $_ . '::');
+ s!::!/!g;
+ require $_ . '.pm';
+ }
+ $PLP::safe->permit(Opcode::full_opset());
+ $PLP::safe->deny(Opcode::opset(':dangerous'));
+ }
+ $PLP::safe->reval($code);
+}
+