With Safe::World you can create multiple virtual instances/compartments of a Perl interpreter, that will work/run without touch the other instances/compartments and mantaining the main interpreter normal.
Each instance (WORLD object) has their own STDOUT, STDERR and STDIN handlers, also has a fake HEADOUT output for the headers implemented inside the STDOUT. Soo, you can use this to redirect the outputs of the WORLD object to a FILEHANDLER, SCALAR or a SUB.
The module Safe::World was created for 3 purposes:
1. A Safe compartment that can be "fully" cleanned.
2. A Safe compartment with the output handlers implemented, creating a full WORLD, working as a normal Perl Interpreter from inside.
3. A WORLD object (a virtual Perl interpreter) that can be linked/assembled with other WORLD objects, and work/run as if the objects where only one, than be able to unlink/disassemble them.
The last is the advanced purpose, that need all the previous resources, and most important thing of Safe::World. Actually this was projected to work with mod_perl, soo the Perl codes can be runned in different compartments, but can have some part of the code cached in memory, specially the Perl Modules (Classes) that need to be loaded all the time.
Soo, you can load your classes in one World, and your script/page in other World, then link them and run your code normally. Then after run it you unlink the 2 Worlds, and only CLEAN the World with your script/page, and now you can keep the 1st World with your Classes cached, to link it again with the next script/page to run.
To get it:
http://cpan.org/authors/id/G/GM/GMPASSOS/Safe-World-0.01.tar.gz
I will appreciate any type of feedback (include your opinions and/or suggestions). ;-P
And please, test it!
Graciliano M. P.
"Creativity is the expression of the liberty".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Safe::World/0.01 - Create multiple virtual instances of a Perl interpreter that can be assembled together.
by liz (Monsignor) on Nov 30, 2003 at 11:01 UTC | |
by gmpassos (Priest) on Nov 30, 2003 at 22:15 UTC | |
|
Re: Safe::World/0.01 - Create multiple virtual instances of a Perl interpreter that can be assembled together.
by Anonymous Monk on Nov 30, 2003 at 05:20 UTC |