--- nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2003/05/10 17:37:39 1.37 +++ nfo/perl/libs/Data/Storage/Handler/Tangram.pm 2003/05/13 16:38:38 1.38 @@ -1,8 +1,11 @@ ############################################ # -# $Id: Tangram.pm,v 1.37 2003/05/10 17:37:39 jonen Exp $ +# $Id: Tangram.pm,v 1.38 2003/05/13 16:38:38 joko Exp $ # # $Log: Tangram.pm,v $ +# Revision 1.38 2003/05/13 16:38:38 joko +# problems with "tied" on 5.6.1/win32 +# # Revision 1.37 2003/05/10 17:37:39 jonen # corrected last commit # @@ -960,32 +963,42 @@ #print "Create child object [$nodename]: " . Dumper($child_entry); } - # get reference of tied node + # get reference of tied node (seems, only on Linux node's are tied!!) my $tied_node = tied $parent->{$nodename}; # insert/change child entry at parent #print "reference: " . ref($parent->{$nodename}) . "\n"; if(ref($parent->{$nodename}) eq 'ARRAY') { - # all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type, - # so a 'PUSH' is not implemented (which could be then done transparently) - my $array = $tied_node->FETCH; - push @$array, $child_entry; - $tied_node->STORE($array); - # node will be normaly untied at 'STORE' - if(tied $parent->{$nodename}) { print "already tied !!\n"; } - else { undef $tied_node; } - } - elsif(ref($parent->{$nodename}) eq 'HASH') { - if(my $key = $query_args->{hash_key}) { - # same problem as with 'ARRAY': - # all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type. - my $hash = $tied_node->FETCH; - $hash->{$key} = $child_entry; - $tied_node->STORE($hash); + # (seems, only on Linux node's are tied!!) + if($tied_node) { + # all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type, + # so a 'PUSH' is not implemented (which could be then done transparently) + my $array = $tied_node->FETCH; + push @$array, $child_entry; + $tied_node->STORE($array); # node will be normaly untied at 'STORE' if(tied $parent->{$nodename}) { print "already tied !!\n"; } else { undef $tied_node; } } else { + push @{$parent->{$nodename}}, $child_entry; + } + } + elsif(ref($parent->{$nodename}) eq 'HASH') { + if(my $key = $query_args->{hash_key}) { + # (seems, only on Linux node's are tied!!) + if($tied_node) { + # same problem as with 'ARRAY': + # all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type. + my $hash = $tied_node->FETCH; + $hash->{$key} = $child_entry; + $tied_node->STORE($hash); + # node will be normaly untied at 'STORE' + if(tied $parent->{$nodename}) { print "already tied !!\n"; } + else { undef $tied_node; } + } else { + $parent->{$nodename}->{$key} = $child_entry; + } + } else { print "ERROR: No HASH KEY given, so not able to insert hash entry!"; } }