Philippe M. Chiasson wrote:
On Thu, 2004-03-25 at 13:30 -0800, Stas Bekman wrote:

Philippe M. Chiasson wrote:


Only problem I
can think of is that if you use PerlSections->dump, your hash will be
dumped as a hash, not seeing the tie magic. So next time around, if you
load your dumped <Perl> configuration, you'll experience hash ordering
trouble once again.

why can't we keep the tiedness?


Well, how are you supposed to correctly dump a tie'd object so it can be
restored by an eval ?

simply. if it's tied(), you know which class it was tied into. so when you dump it, add the tie directive to tie it back to the class it was tied to in first place. Or just use Storable?


It's actually a lot more complicated than this. For example, imagine if

<Perl>
tie %Location, 'Tie::DBI';
</Perl>

I could possibly do :

if (tied %Location) {
        [...]
}

And try and generate a correct dumper of the internal/private data
structure underlying the tied object, but there are no guarantees that
when you'll restore it back it'll work correctly. And to generate code
that can be eval'ed back, you can just say:

Re-tie %Location with class 'Tie::DBI' using this { 'foo' => 'bar' } as
the untied object... Unless you call TIEHASH once again, and cause the
class to re-tie, but then how do you reinject it the right data.

I don't know if I am missing something terribly simple, but the only
think I can think of is detecting tied %Location and screaming "Bad
boy!" if ->dump is called...

Hmm, what I was suggestion is that if the source was:


 tie %Location, Foo;
 %Location = (...);

the dump will be exactly that:

 tie %Location, Foo;
 %Location = (...);

preserving the order. How does Storable deal with it?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to