--- nfo/perl/libs/Data/Mungle/Transform/Encode.pm 2003/03/27 15:17:07 1.4 +++ nfo/perl/libs/Data/Mungle/Transform/Encode.pm 2003/04/09 07:22:34 1.5 @@ -1,7 +1,10 @@ ## ------------------------------------------------------------------------- -## $Id: Encode.pm,v 1.4 2003/03/27 15:17:07 joko Exp $ +## $Id: Encode.pm,v 1.5 2003/04/09 07:22:34 joko Exp $ ## ------------------------------------------------------------------------- ## $Log: Encode.pm,v $ +## Revision 1.5 2003/04/09 07:22:34 joko +## childObj2string now inside Encode.pm, renamed to 'twingle_reference' +## ## Revision 1.4 2003/03/27 15:17:07 joko ## namespace fixes for Data::Mungle::* ## @@ -27,7 +30,13 @@ require Exporter; our @ISA = qw( Exporter ); -our @EXPORT_OK = qw( &latin_to_utf8 &latin_to_utf8_scalar &utf8_to_latin &utf8_to_latin_scalar ); +our @EXPORT_OK = qw( + &latin_to_utf8 + &latin_to_utf8_scalar + &utf8_to_latin + &utf8_to_latin_scalar + &twingle_reference +); use Unicode::String qw(utf8 latin1); @@ -94,5 +103,29 @@ } } + +# encodes object-references to serialized string representations +# made up of: +# - 'o___'??? +# - 'o_{guid}_{classname}'!!! + +# TODO: enhance further! +# make it possible to twingle OID-, GUID- and/or other references + +sub twingle_reference { + my $obj = shift; + my $option = shift; + my $string = 'n/a'; + + #if ($option == 1) { + if ((my $classname = ref $obj) && (my $guid = $obj->{guid})) { + $string = join('_', 'o', $guid, $classname); + } + #} + + return $string; +} + + 1; __END__