Stumped with Safe

djberg96 on 2002-03-20T20:52:50

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. :)