in reply to using Safe.pm

Did you read the documenation of Safe and more specifically, its reval method?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: using Safe.pm
by Aldebaran (Curate) on Jul 06, 2015 at 06:28 UTC

    I did, but it's all very much above my head. If I stored the JAPH as a string called $japh, then would an appropriate call consist of:

    my $japh = 'bla bla bla'; my $return = reval($japh, STRICT); say "return is $return";
      No, that will not work.

      Safe is an object-oriented module and does not export a reval function.

      You use this module as follows:

      use Modern::Perl qw/2015/; use Safe; my $compartment = Safe->new(); my $unsafe_code = '# add some unsafe code here'; my $result = $compartment->reval($unsafe_code); say "Result is $result";

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics

      I did, but it's all very much above my head. If I stored the JAPH as a string called $japh, then would an appropriate call consist of:

      You need to have the docs at eye level and start with SYNOPSIS of Safe, reval is a method