Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
tkrevdiff - graphical display of diffs between revisions (RCS or CVS)
http://ptktools.sourceforge.net/#tkrevdiff
My personal opinion on this is that 'tie' is for doing things that lay
outside of serialization. 'tie' is for when you are trying add semantics to a
hash, but still have it look like a normal hash. Serialization blows it's
cover so to speak.
YAML.pm can serialize more native data structures than any other dumper.
Everything from globs to coderefs to opaque objects to file-handles. But I
leave tied stuff alone. The creator of the tied thingy wanted me to think it
was just a thingy, and I respect that.
Cheers, Brian
My actual problem is that I have nested objects with ordered hashes
(using Tie::IxHash). Data::Dumper destroys the order by storing the
Tie::IxHash objects as normal hashes.
It would be nice to have an option (not the default) for Data::Dumper
to serialize the internal representation of a tied object.
Regards,
Slaven
--
Slaven Rezic - slaven...@berlin.de
tktimex - project time manager
http://sourceforge.net/projects/ptktools/
To safely serialize a tied thing, you would first need to
(1) fetch the object it's tied to using tied()
(2) temporarily bless that object into another class
(to avoid having it's "UNTIE" method being called)
(3) untie the thing
(4) bless the object into it's original class
(5) serialize both the now untied thing,
and the object it was tied to
(6) restore the tie, using Tie::Restore or somesuch.
--
tr/`4/ /d, print "@{[map --$| ? ucfirst lc : lc, split]},\n" for
pack 'u', pack 'H*', 'ab5cf4021bafd28972030972b00a218eb9720000';