Safe - Compile and execute code in restricted compartments. The Safe extension module allows the creation of compartments in which perl code can be evaluated. Each compartment has
a new namespace
The root of the namespace (i.e. main::) is changed to a different package and code evaluated in the compartment cannot refer to variables outside this namespace, even with run-time glob lookups and other tricks.
Code which is compiled outside the compartment can choose to place variables into (or share variables with) the compartments namespace and only that data will be visible to code evaluated in the compartment.
By default, the only variables shared with compartments are the underscore variables $_ and @_ (and, technically, the less frequently used %_, the _ filehandle and so on). This is because otherwise perl operators which default to $_ will not work and neither will the assignment of arguments to @_ on subroutine entry.
an operator mask
Each compartment has an associated operator mask. Recall that perl code is compiled into an internal format before execution. Evaluating perl code (e.g. via eval or do file) causes the code to be compiled into an internal format and then, provided there was no error in the compilation, executed. Code evaluated in a compartment compiles subject to the compartments operator mask. Attempting to evaluate code in a compartment which contains a masked operator will cause the compilation to fail with an error. The code will not be executed.