Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: using Safe.pm

by Aldebaran (Curate)
on Jul 06, 2015 at 06:28 UTC ( [id://1133313]=note: print w/replies, xml ) Need Help??


in reply to Re: using Safe.pm
in thread using Safe.pm

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";

Replies are listed 'Best First'.
Re^3: using Safe.pm
by CountZero (Bishop) on Jul 06, 2015 at 12:10 UTC
    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
Re^3: using Safe.pm
by Anonymous Monk on Jul 06, 2015 at 07:56 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:

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1133313]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-26 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found