git://git.jankratochvil.net
/
MyWeb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4cd6b19
)
Support also /_push$/ keys for arrays auto-appends.
author
short
<>
Sun, 28 Aug 2005 05:04:32 +0000
(
05:04
+0000)
committer
short
<>
Sun, 28 Aug 2005 05:04:32 +0000
(
05:04
+0000)
Hash/Sub.pm
patch
|
blob
|
history
diff --git
a/Hash/Sub.pm
b/Hash/Sub.pm
index
9fa5fd7
..
cde07be
100644
(file)
--- a/
Hash/Sub.pm
+++ b/
Hash/Sub.pm
@@
-37,4
+37,15
@@
my($this,$key)=@_;
return &{$val}($this,$key);
}
return &{$val}($this,$key);
}
+sub STORE
+{
+my($this,$key,$value)=@_;
+
+ return $this->SUPER::STORE($key,$value) if $key!~/_push$/;
+ my $val_orig=$this->SUPER::FETCH($key);
+ $val_orig=[] if !defined $val_orig;
+ $val_orig=[$val_orig] if "ARRAY" ne ref $val_orig;
+ return $this->SUPER::STORE($key,[@$val_orig,$value]);
+}
+
1;
1;