perl 5.0 alpha 4
[p5sagit/p5-mst-13.2.git] / tiedbm
1 #!./perl
2
3 # $RCSfile: dbm.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:43 $
4
5 {
6     package Any_DBM_File;
7     @ISA = (NDBM_File, ODBM_File, GDBM_File, SDBM_File, DB_File, DBZ_File);
8 }
9 {
10     package XDBM_File;
11     sub new { print "new @_\n"; bless {FOO => 'foo'} }
12     sub fetch { print "fetch @_\n"; $_[0]->{$_[1]} }
13     sub store { print "store @_\n"; $_[0]->{$_[1]} = $_[2] }
14     sub delete { print "delete @_\n"; delete ${$_[0]}{$_[1]} }
15     sub DESTROY { print "DESTROY @_\n"; undef %{$_[0]}; }
16 }
17
18 init SDBM_File;
19
20 tie %h, SDBM_File, 'Op.sdbm', 0x202, 0640;
21
22 $h{BAR} = 'bar';
23 $h{FOO} = 'foo';
24 #print $h{BAR}, "\n";
25 #delete $h{BAR};
26 #print $h{BAR}, "\n";
27
28 while (($key,$val) = each %h) { print "$key => $val\n"; }
29 @keys = sort keys %h;
30 @values = sort values %h;
31 print "@keys\n@values\n";
32
33 untie %h;
34