in reply to reval in Safe.pm and objects
Now you can call Person's methods on $datacopy->{person}. You can actually rebless the reference with its own binding: bless $datacopy->{person}, ref $datacopy->{person}; This will work, even though the package name referred to inside the compartment before, so long as $datacopy is inside an unrestricted package, not in MySafe. You could automate the process with a a loop like ref($_) and bless($_, ref $_) for values %$datacopy; Ultimately I'd return an anonymous hash from inside the configuration data:my $datacopy = $MySafe::data; bless $datacopy->{person}, 'Person';
$string = <<'EOM'; { 'person' => bless( [ 42 ], 'Person' ) }; EOM my $data = Safe->new()->reval($string); ref($_) and bless($_, ref $_) for values %$data;
Makeshifts last the longest.
|
|---|