blob: 8a675aa4be6dfa4772104120786836e689e59b9b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
|