Finally got it to work (with lots of warnings) by using plain old Safe. I couldn't get a proper run with Safe::World. I guess is not ready for stable use yet. It has a similar interface to Safe though so one can easilly port to it once it's a bit more stable. Keep up the good work gmpassos.
Thanks to all the monks that have helped me.
Update:
I might be doing it all wrong. I have replacated the failing part(s) here.
This should print 144.
#!/usr/bin/perl use strict; use warnings 'all'; use Safe::World; my ($stdout, $stderr); my $world = Safe::World->new( stdout => \$stdout, stderr => \$stderr, ); print "World created\n"; $world->eval('print 12 ** 2, "\n";'); die $@ if $@; print $stdout, "***End***\n"; # CLEANup should follow
The output produced is the followng (paths foobared):
Scalar value @_[0] better written as $_[0] at .../Safe/World/ScanPack. +pm line 88. Scalar value @_[0] better written as $_[0] at .../Safe/World.pm line 3 +45. Useless use of hash element in void context at .../Safe/World.pm line +1007. Use of uninitialized value in string eq at .../Safe/World.pm line 170. Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 344. World created Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 386. syntax error at (eval 18) line 1, near "=" Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 943. Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 956. Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 386. Use of uninitialized value in numeric ne (!=) at .../Safe/World.pm lin +e 386. Use of uninitialized value in string ne at .../Safe/World/stdout.pm li +ne 218. Use of uninitialized value in string ne at .../Safe/World/stdout.pm li +ne 218.
In reply to Re: Unloading a module completely
by holo
in thread Unloading a module completely
by holo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |