summaryrefslogtreecommitdiff
path: root/tiedbm
diff options
context:
space:
mode:
Diffstat (limited to 'tiedbm')
-rwxr-xr-xtiedbm34
1 files changed, 34 insertions, 0 deletions
diff --git a/tiedbm b/tiedbm
new file mode 100755
index 0000000000..8a675aa4be
--- /dev/null
+++ b/tiedbm
@@ -0,0 +1,34 @@
+#!./perl
+
+# $RCSfile: dbm.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:43 $
+
+{
+ package Any_DBM_File;
+ @ISA = (NDBM_File, ODBM_File, GDBM_File, SDBM_File, DB_File, DBZ_File);
+}
+{
+ package XDBM_File;
+ sub new { print "new @_\n"; bless {FOO => 'foo'} }
+ sub fetch { print "fetch @_\n"; $_[0]->{$_[1]} }
+ sub store { print "store @_\n"; $_[0]->{$_[1]} = $_[2] }
+ sub delete { print "delete @_\n"; delete ${$_[0]}{$_[1]} }
+ sub DESTROY { print "DESTROY @_\n"; undef %{$_[0]}; }
+}
+
+init SDBM_File;
+
+tie %h, SDBM_File, 'Op.sdbm', 0x202, 0640;
+
+$h{BAR} = 'bar';
+$h{FOO} = 'foo';
+#print $h{BAR}, "\n";
+#delete $h{BAR};
+#print $h{BAR}, "\n";
+
+while (($key,$val) = each %h) { print "$key => $val\n"; }
+@keys = sort keys %h;
+@values = sort values %h;
+print "@keys\n@values\n";
+
+untie %h;
+