Safe::World::Scope

Safe::World::Scope is a Perl module which can be used to enable access to a package scope not shared by a World.
Download

Safe::World::Scope Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Graciliano M. P.
  • Publisher web site:
  • http://search.cpan.org/~gmpassos/

Safe::World::Scope Tags


Safe::World::Scope Description

Safe::World::Scope is a Perl module which can be used to enable access to a package scope not shared by a World. Safe::World::Scope is a Perl module which can be used to enable access to a package scope not shared by a World.This enable the access to a not shared scopes. Soo, if you want to have an object created outside inside a World, but without share the packages of the object, you can design it to have access to sub-classes through scope access.BEHAVIORThe best way to understand what it does and why it exists, is to know the behavior of an object created outside of a World, but running it inside a World:When an object created outside is used inside a World, for example, when you call a method, the object can see the scope of were the method/sub were created: $world->eval(q` $object->foo(); `);Soo, $object can call foo(), and foo() will see the scope of the package of $object, even if this package doesn't exists inside the World.But let's say that foo() call some other package: #### THIS IS CODE OUTSIDE OF THE WORLD: package object ; use Data::Dumper qw() ; sub foo { my $this = shift ; my $dump = Data::Dumper::Dumper($this) ; }Now foo() call Data::Dumper::Dumper(), but the package Data::Dumper exists only outside of the World and is not shared!Here we will get an error, since foo can't have access to the scope of Data::Dumper::, since it will try to get the sub inside the World, at SAFEWORLD1::Data::Dumper::Dumper, and not at main::Data::Dumper::Dumper (where it really exists).Soo, to make the object work, you can design it to access outside scopes through a Scope object: #### THIS IS CODE OUTSIDE OF THE WORLD: package object ; use Data::Dumper qw() ; my $SCOPE_Data_Dumper = new Safe::World::Scope('Data::Dumper') ; sub foo { my $this = shift ; my $dump = $SCOPE_Data_Dumper->call('Dumper',$this) ; }Now with this design you can use $object inside the World without share any other package, what make it much more safer.This is how the HPL object works inside the compartment, and this was created specially for it. Requirements: · Perl


Safe::World::Scope Related Software