
Thread::Isolate::Map - Map/link packages of one thread to many other threads.

The idea of this module is to map a package of one thread to many other threads, saving memory through many threads.
Thread::Isolate::Map supports map for SCALAR, ARRAY, HASH, HANDLE (IO) and CODE symbols.

use Thread::Isolate ; ## Is recomended to load it before to save memory.
use Thread::Isolate::Map ;
my $thi = Thread::Isolate->new() ;
$thi->eval(q`
package Foo ;
$FOOVAL = 0 ;
`) ;
my $thi1 = Thread::Isolate->new() ;
my $thi2 = Thread::Isolate->new() ;
$thi1->map_package('Foo',$thi) ;
$thi2->map_package('Foo',$thi) ;
$thi1->eval('$Foo::FOOVAL = 10 ;'); ## $FOOVAL is 10 now. (thi1)
$thi2->eval('$Foo::FOOVAL += 10 ;'); ## $FOOVAL is 20 now. (thi2)
$thi->eval('return $Foo::FOOVAL'); ## returns 20. (thi)
As you can see in the code above all the 3 threads share the same package, and the package symbols like $FOOVAL.

Maps a local package to a thread package.
The package to map.
The Thread::Isolate object that has the real package.
Scan the symbol table entries of a package.
If defined will scan the package inside the thread.
The package to scan.
If TRUE will do a recursive scan, getting symbols of sub-packages.

All the mapped HANDLEs (IO) will be automatically flushed ($| = 1), since is not possible to flush from an external thread, also will avoid lose of output data when the HANDLE is not closed explicity when the process goes out.

Thread::Isolate, Thread::Isolate::Pool.

Graciliano M. P. <gmpassos@cpan.org>
I will appreciate any type of feedback (include your opinions and/or suggestions). ;-P

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.