summaryrefslogtreecommitdiff
path: root/tiearray
blob: b765a853d58def53c64c233b8cd10a34e4e99506 (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
#!./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 FAKEARRAY;
    sub new { print "new @_\n"; bless ['foo'] }
    sub fetch { print "fetch @_\n"; $_[0]->[$_[1]] }
    sub store { print "store @_\n"; $_[0]->[$_[1]] = $_[2] }
    sub DESTROY { print "DESTROY @_\n"; undef @{$_[0]}; }
}

tie @h, FAKEARRAY, ONE, TWO, THREE;

$h[1] = 'bar';
$h[2] = 'baz';
print $h[0], "\n";
print $h[1], "\n";
print $h[2], "\n";

untie @h;