--- nfo/perl/libs/Data/Mungle/Transform/Deep.pm 2003/02/22 17:13:55 1.14 +++ nfo/perl/libs/Data/Mungle/Transform/Deep.pm 2003/04/04 17:31:23 1.20 @@ -1,7 +1,25 @@ ## --------------------------------------------------------------------------- -## $Id: Deep.pm,v 1.14 2003/02/22 17:13:55 jonen Exp $ +## $Id: Deep.pm,v 1.20 2003/04/04 17:31:23 joko Exp $ ## --------------------------------------------------------------------------- ## $Log: Deep.pm,v $ +## Revision 1.20 2003/04/04 17:31:23 joko +## minor update to 'childObj2string' +## +## Revision 1.19 2003/03/28 03:11:25 jonen +## + bugfix +## +## Revision 1.18 2003/03/28 03:07:26 jonen +## + minor changes +## +## Revision 1.17 2003/03/27 15:17:07 joko +## namespace fixes for Data::Mungle::* +## +## Revision 1.16 2003/03/27 15:04:52 joko +## minor update: comment +## +## Revision 1.15 2003/02/27 14:39:48 jonen +## + fixed bug at _hash2object() +## ## Revision 1.14 2003/02/22 17:13:55 jonen ## + added function 'childObject2string()' to encode 'child'-references to option related string ## + use new option at 'expand()' for replacing 'childObject2string' @@ -53,7 +71,7 @@ ## --------------------------------------------------------------------------- -package Data::Transform::Deep; +package Data::Mungle::Transform::Deep; use strict; use warnings; @@ -72,8 +90,8 @@ use Iterate; use Pitonyak::DeepCopy; -use Data::Transform::Encode qw( latin_to_utf8 latin_to_utf8_scalar utf8_to_latin utf8_to_latin_scalar ); -use Data::Code::Ref qw( ref_slot ); +use Data::Mungle::Transform::Encode qw( latin_to_utf8 latin_to_utf8_scalar utf8_to_latin utf8_to_latin_scalar ); +use Data::Mungle::Code::Ref qw( ref_slot ); sub numhash2list { my $vref = shift; @@ -288,7 +306,7 @@ sub merge_to { _hash2object(@_); # TODO: - # re-implement using CPAN's "Iterate". + # re-implement using CPAN's "Iterate" and/or a modified Hash::Merge. } @@ -305,7 +323,7 @@ numhash2list($data) if ($options->{php}); # utf8-conversion/-encoding (essential for I18N) - var_utf2iso($data) if ($options->{utf8}); + utf8_to_latin($data) if ($options->{utf8}); # get fresh object from database # todo: @@ -476,15 +494,22 @@ } +# encodes object-references to serialized string representations +# made up of: +# - 'o___'??? +# - 'o_{guid}_{classname}'!!! sub childObj2string { my $obj = shift; my $option = shift; - my $classname = ref $obj; + my $string = 'n/a'; + + if ($option == 1) { + if ((my $classname = ref $obj) && (my $guid = $obj->{guid})) { + $string = join('_', 'o', $guid, $classname); + } + } - if($option == 1) { - my $string = "o_" . $classname . "_" .$obj->{guid}; - return $string; - } + return $string; }