Dice has asked for the wisdom of the Perl Monks concerning the following question:
Say I were to tie a hash to something...
tie(%hash, 'My::Hash::Tie::Class', @args);
With 'tied', I can get at the underlying stored object:
my $obj = tied(%hash);
What I want to do is sort of the inverse of tied -- given an underlying object that is an instance of My::Hash::Tie::Class, I want to be able to recreate a tied hash:
my %newhash = Foo($obj);
And now %newhash is a tied hash to My::Hash::Tie::Class... though I'm not sure if it would be a copy-by-ref or a copy-by-value of the original %hash. (Not much sure if it makes a difference to met yet, either.)
Any suggestions on what Foo() should be? Either how to create it myself, or what real function / CPAN module / etc. exists out there already? Note that I'm not just looking for functions. Whatever method does the job, I'm happy with.
Cheers,
Richard
|
|---|