perl5.000 patch.0o: [address] a few more Configure and build nits.
[p5sagit/p5-mst-13.2.git] / lib / TieHash.pm
CommitLineData
a0d0e21e 1package TieHash;
2use Carp;
3
4sub new {
5 my $pack = shift;
6 $pack->TIEHASH(@_);
7}
8
9# Grandfather "new"
10
11sub TIEHASH {
12 my $pack = shift;
13 if (defined &{"{$pack}::new"}) {
14 carp "WARNING: calling ${pack}->new since ${pack}->TIEHASH is missing"
15 if $^W;
16 $pack->new(@_);
17 }
18 else {
19 croak "$pack doesn't define a TIEHASH method";
20 }
21}
22
23sub EXISTS {
24 my $pack = ref $_[0];
25 croak "$pack doesn't define an EXISTS method";
26}
27
28sub CLEAR {
29 my $self = shift;
30 my $key = $self->FIRSTKEY(@_);
31 my @keys;
32
33 while (defined $key) {
34 push @keys, $key;
35 $key = $self->NEXTKEY(@_, $key);
36 }
37 foreach $key (@keys) {
38 $self->DELETE(@_, $key);
39 }
40}
41
421;