Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Mileage with safe

by mortis (Pilgrim)
on Dec 11, 2001 at 20:26 UTC ( #130963=note: print w/replies, xml ) Need Help??

in reply to Mileage with safe

Are you just trying to make sure that errors in the plugin don't cause your code to die? Which eval is great for. Or are you trying to restrict the plugin to only be able to perform a (very) limited amount of actions? Which should be great for.

If all you're trying to do is keep the plugin's errors from aborting your code, but still want it to be able to do anything that the rest of the codebase does, then eval is probably the best choice. Just log $@ after the eval so the plugin authors have a way of tracking down their errors.

Replies are listed 'Best First'.
Re: Re: Mileage with safe
by simon.proctor (Vicar) on Dec 11, 2001 at 20:43 UTC
    I want to build a sandbox environment for the plugins but where they can only play with the toys I give them :). Eval allows any and all code to be executed (provided its valid Perl of course) but Safe appears not to. I intend to follow the standard approach of 'what is not permitted is automatically denied'.

    I agree that Safe is the answer hence my original question.

    I have already started to lock down the environment to prevent clobbering by using 'tie' to control access to the hash. I have done this by appropriate use of STORE() and caller().

    Now that I have had longer to think about it and try some code out, my wants list for features is something like:

    1. Allow controlled access to the environment (WIP)
    2. Remove access to anything dangerous (well... as much as possible at least)
    3. Providing as much API code as possible to make the developers life easier :P
    4. Allow plugins to be chained (etc etc etc).

    If I can get this framework right then hopefully I can reapply it to many of my other projects too. Not just a content management system.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2022-08-18 16:02 GMT
Find Nodes?
    Voting Booth?

    No recent polls found