Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

djberg96 (2603)

djberg96
  (email not shown publicly)

Journal of djberg96 (2603)

Wednesday March 20, 2002
03:52 PM

Stumped with Safe

[ #3683 ]
Given that I've slurped an OO package with a 'new' and 'init' method into a variable '$package', and the following code:

use Safe;
my $sandbox = Safe->new;

I can do this:

$sandbox->reval("$package->new");

... or this ...

$sandbox->reval("$package->new->init");

But I can't figure out how to do this:

my $obj = $sandbox->reval("$package->new");
$sandbox->reval("$obj->init"); # Crunch!

I tried reblessing '$obj' into '$package', but that didn't work. Is what I'm trying to do even possible?

Oh, well. It's enough to start with. :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.