summaryrefslogtreecommitdiff
path: root/lib/TieHash.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TieHash.pm')
-rw-r--r--lib/TieHash.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/TieHash.pm b/lib/TieHash.pm
index 0cb4afa20d..2d5c2f41f0 100644
--- a/lib/TieHash.pm
+++ b/lib/TieHash.pm
@@ -39,4 +39,20 @@ sub CLEAR {
}
}
+# The TieHash::Std package implements standard perl hash behaviour.
+# It exists to act as a base class for classes which only wish to
+# alter some parts of their behaviour.
+
+package TieHash::Std;
+@ISA = qw(TieHash);
+
+sub TIEHASH { bless {}, $_[0] }
+sub STORE { $_[0]->{$_[1]} = $_[2] }
+sub FETCH { $_[0]->{$_[1]} }
+sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
+sub NEXTKEY { each %{$_[0]} }
+sub EXISTS { exists $_[0]->{$_[1]} }
+sub DELETE { delete $_[0]->{$_[1]} }
+sub CLEAR { %{$_[0]} = () }
+
1;