djberg96 has asked for the wisdom of the Perl Monks concerning the following question:
Perl 5.6.1 on Solaris 8
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"); # Fails!
$sandbox->reval("$obj = $package->new; $obj->init"); # Fails!
I even tried reblessing '$obj' into '$package', but that didn't work.
Is what I'm trying to do even possible? Any suggestions?
Regards,
Mr. Sunblade
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: Safe question
by tye (Sage) on Mar 22, 2002 at 16:06 UTC | |
by djberg96 (Acolyte) on Mar 22, 2002 at 18:50 UTC | |
by tye (Sage) on Mar 22, 2002 at 21:49 UTC | |
|
Re: Safe question
by simon.proctor (Vicar) on Mar 22, 2002 at 19:00 UTC |