in reply to using features in a Safe compartment
So using the "say" doesn't work because it evaluates to nothing, and returns nothing. In fact, I was kind of surprised that it didn't at least return "1" since say should return "true". But who knows.use warnings; use strict; use Safe; use feature qw{say}; say "Hello!"; my $cft = Safe->new; $cft->deny_only(); my $ret = $dft->reval(qq{return "Hello Again!"}, undef); say $ret;
my $unsafe = qq| require feature; feature->import( qw{say switch} ); say "Hope this works"; return "I did what you said"; |; # explicit load of feature, but doesn't work (unexpected result) $ret = $cft->reval( $unsafe, undef );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: using features in a Safe compartment
by djerius (Beadle) on Mar 22, 2011 at 04:09 UTC |