Subject: | reval defaults to 'no strict' without using undocumented argument |
The description of the reval method summarizes the arguments as 'reval
(STRING)' instead of the correct 'reval (STRING, STRICT)'.
Thus, when the STRICT arg is omitted, lexless_anon_sub gets called with
undef which causes the "$_[1] ? 'use' : 'no'" clause to default to 'no'.
I've attached a small patch that updates the description of reval to
correctly describe the behavior with emphasis on the default of 'no
strict;'.
Subject: | Safe_pm_pod_update.patch |
--- Safe.pm.orig 2008-03-13 06:49:12.000000000 -0400
+++ Safe.pm 2008-08-07 21:48:59.000000000 -0400
@@ -486,7 +486,7 @@
${$cpt->varglob('foo')} = "Hello world";
-=item reval (STRING)
+=item reval (STRING, STRICT)
This evaluates STRING as perl code inside the compartment.
@@ -513,6 +513,10 @@
where earlier versions of perl made it hard to mimic the return
behaviour of the eval() command and the context was always scalar.
+The formerly undocumented STRICT argument sets strictness: if true
+'use strict;' is used, otherwise it uses 'no strict;'. B<Note>: if
+STRICT is omitted 'no strict;' is the default.
+
Some points to note:
If the entereval op is permitted then the code can use eval "..." to