http://www.perlmonks.org?node_id=894622

djerius has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to use features in a Safe compartment but they're not being recognized. Here's an example using Perl 5.12.2.
use feature qw[ say ]; use Safe; # works here say "Hello!"; my $cft = Safe->new; # allow all opcodes $cft->deny_only(); # doesn't work here (expected result) $cft->reval( 'say "Hello Again!"' ); # explicit load of feature, but doesn't work (unexpected result) $cft->reval( 'use feature qw[ say ]; say "Hello Again! 2"' );
And here's what it spits out:
Hello! String found where operator expected at (eval 5) line 1, near "say "He +llo Again!"" (Do you need to predeclare say?) String found where operator expected at (eval 7) line 1, near "say "He +llo Again! 2"" (Do you need to predeclare say?)
Does anyone have any experience with this?

Thanks,
Diab

Update: I should be clearer about the question:

How does one enable features in a Safe compartment? My example code seems to indicate that a simple use feature doesn't do anything within the compartment. Am I mising something?