| 3 |
# $Id$ |
# $Id$ |
| 4 |
# |
# |
| 5 |
# $Log$ |
# $Log$ |
| 6 |
|
# Revision 1.38 2003/05/13 16:38:38 joko |
| 7 |
|
# problems with "tied" on 5.6.1/win32 |
| 8 |
|
# |
| 9 |
|
# Revision 1.37 2003/05/10 17:37:39 jonen |
| 10 |
|
# corrected last commit |
| 11 |
|
# |
| 12 |
# Revision 1.36 2003/05/10 17:31:18 jonen |
# Revision 1.36 2003/05/10 17:31:18 jonen |
| 13 |
# + added new functions related to 'create' item |
# + added new functions related to 'create' item |
| 14 |
# - createNode() |
# - createNode() |
| 15 |
# # creates non-persistent 'deep dummy filled' object |
# # creates non-persistent 'deep dummy filled' object |
| 16 |
# - |
# - insertChildNode() |
| 17 |
|
# # inserts child node at given parent (child node haven't to exists, |
| 18 |
|
# createNode will be injected transparently) |
| 19 |
# |
# |
| 20 |
# Revision 1.35 2003/04/19 16:09:48 jonen |
# Revision 1.35 2003/04/19 16:09:48 jonen |
| 21 |
# + added operator dispatching (currently for getting ref-type) at 'getListFiltered' |
# + added operator dispatching (currently for getting ref-type) at 'getListFiltered' |
| 963 |
#print "Create child object [$nodename]: " . Dumper($child_entry); |
#print "Create child object [$nodename]: " . Dumper($child_entry); |
| 964 |
} |
} |
| 965 |
|
|
| 966 |
# get reference of tied node |
# get reference of tied node (seems, only on Linux node's are tied!!) |
| 967 |
my $tied_node = tied $parent->{$nodename}; |
my $tied_node = tied $parent->{$nodename}; |
| 968 |
|
|
| 969 |
# insert/change child entry at parent |
# insert/change child entry at parent |
| 970 |
#print "reference: " . ref($parent->{$nodename}) . "\n"; |
#print "reference: " . ref($parent->{$nodename}) . "\n"; |
| 971 |
if(ref($parent->{$nodename}) eq 'ARRAY') { |
if(ref($parent->{$nodename}) eq 'ARRAY') { |
| 972 |
# all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type, |
# (seems, only on Linux node's are tied!!) |
| 973 |
# so a 'PUSH' is not implemented (which could be then done transparently) |
if($tied_node) { |
| 974 |
my $array = $tied_node->FETCH; |
# all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type, |
| 975 |
push @$array, $child_entry; |
# so a 'PUSH' is not implemented (which could be then done transparently) |
| 976 |
$tied_node->STORE($array); |
my $array = $tied_node->FETCH; |
| 977 |
# node will be normaly untied at 'STORE' |
push @$array, $child_entry; |
| 978 |
if(tied $parent->{$nodename}) { print "already tied !!\n"; } |
$tied_node->STORE($array); |
|
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); |
|
| 979 |
# node will be normaly untied at 'STORE' |
# node will be normaly untied at 'STORE' |
| 980 |
if(tied $parent->{$nodename}) { print "already tied !!\n"; } |
if(tied $parent->{$nodename}) { print "already tied !!\n"; } |
| 981 |
else { undef $tied_node; } |
else { undef $tied_node; } |
| 982 |
} else { |
} else { |
| 983 |
|
push @{$parent->{$nodename}}, $child_entry; |
| 984 |
|
} |
| 985 |
|
} |
| 986 |
|
elsif(ref($parent->{$nodename}) eq 'HASH') { |
| 987 |
|
if(my $key = $query_args->{hash_key}) { |
| 988 |
|
# (seems, only on Linux node's are tied!!) |
| 989 |
|
if($tied_node) { |
| 990 |
|
# same problem as with 'ARRAY': |
| 991 |
|
# all tangram types are tied as 'SCALAR' with special 'FETCH', 'STORE' methods per type. |
| 992 |
|
my $hash = $tied_node->FETCH; |
| 993 |
|
$hash->{$key} = $child_entry; |
| 994 |
|
$tied_node->STORE($hash); |
| 995 |
|
# node will be normaly untied at 'STORE' |
| 996 |
|
if(tied $parent->{$nodename}) { print "already tied !!\n"; } |
| 997 |
|
else { undef $tied_node; } |
| 998 |
|
} else { |
| 999 |
|
$parent->{$nodename}->{$key} = $child_entry; |
| 1000 |
|
} |
| 1001 |
|
} else { |
| 1002 |
print "ERROR: No HASH KEY given, so not able to insert hash entry!"; |
print "ERROR: No HASH KEY given, so not able to insert hash entry!"; |
| 1003 |
} |
} |
| 1004 |
} |
} |