2 |
## $Id$ |
## $Id$ |
3 |
## --------------------------------------------------------------------------- |
## --------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.21 2003/04/09 07:21:56 joko |
6 |
|
## childObj2string now inside Encode.pm, renamed to 'twingle_reference' |
7 |
|
## |
8 |
## Revision 1.20 2003/04/04 17:31:23 joko |
## Revision 1.20 2003/04/04 17:31:23 joko |
9 |
## minor update to 'childObj2string' |
## minor update to 'childObj2string' |
10 |
## |
## |
93 |
use Iterate; |
use Iterate; |
94 |
|
|
95 |
use Pitonyak::DeepCopy; |
use Pitonyak::DeepCopy; |
96 |
use Data::Mungle::Transform::Encode qw( latin_to_utf8 latin_to_utf8_scalar utf8_to_latin utf8_to_latin_scalar ); |
use Data::Mungle::Transform::Encode qw( latin_to_utf8 latin_to_utf8_scalar utf8_to_latin utf8_to_latin_scalar twingle_reference ); |
97 |
use Data::Mungle::Code::Ref qw( ref_slot ); |
use Data::Mungle::Code::Ref qw( ref_slot ); |
98 |
|
|
99 |
sub numhash2list { |
sub numhash2list { |
184 |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
185 |
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
186 |
if ($item && $options->{childObj2string}) { |
if ($item && $options->{childObj2string}) { |
187 |
$item = childObj2string($item, $options->{childObj2string}); |
$item = twingle_reference($item); |
188 |
} else { |
} else { |
189 |
# ... expand structure recursively |
# ... expand structure recursively |
190 |
$item = expand($_[0], $options); |
$item = expand($_[0], $options); |
221 |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
# if $options->{childObj2string} is TRUE or STRING don't expand referenced object, |
222 |
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
# instead replace it by per option choosed string (default: o_<classname>_<ref type>_<guid> ) |
223 |
if ($item && $options->{childObj2string} && !(ref $_[1] eq "ARRAY") && !(ref $_[1] eq "HASH")) { |
if ($item && $options->{childObj2string} && !(ref $_[1] eq "ARRAY") && !(ref $_[1] eq "HASH")) { |
224 |
$item = childObj2string($item, $options->{childObj2string}); |
$item = twingle_reference($item); |
225 |
} else { |
} else { |
226 |
# ... expand structure recursively |
# ... expand structure recursively |
227 |
$item = expand($_[1], $options); |
$item = expand($_[1], $options); |
497 |
} |
} |
498 |
|
|
499 |
|
|
|
# encodes object-references to serialized string representations |
|
|
# made up of: |
|
|
# - 'o_<classname>_<ref type>_<guid>'??? |
|
|
# - 'o_{guid}_{classname}'!!! |
|
|
sub childObj2string { |
|
|
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; |
|
|
} |
|
|
|
|
|
|
|
500 |
1; |
1; |
501 |
__END__ |
__END__ |