diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm')
-rw-r--r-- | Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm | 80 |
1 files changed, 16 insertions, 64 deletions
diff --git a/Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm b/Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm index 7cfaa4afb98..87ef28e1ef0 100644 --- a/Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm +++ b/Master/tlpkg/tlperl/lib/Memoize/SDBM_File.pm @@ -1,75 +1,27 @@ -package Memoize::SDBM_File; - -=head1 NAME - -Memoize::SDBM_File - glue to provide EXISTS for SDBM_File for Storable use - -=head1 DESCRIPTION - -See L<Memoize>. - -=cut +use strict; use warnings; -use SDBM_File; -@ISA = qw(SDBM_File); -$VERSION = '1.03'; - -$Verbose = 0; - -sub AUTOLOAD { - warn "Nonexistent function $AUTOLOAD invoked in Memoize::SDBM_File\n"; -} - -sub import { - warn "Importing Memoize::SDBM_File\n" if $Verbose; -} +package Memoize::SDBM_File; +our $VERSION = '1.16'; +use SDBM_File 1.01; # for EXISTS support +our @ISA = qw(SDBM_File); -my %keylist; +1; -# This is so ridiculous... -sub _backhash { - my $self = shift; - my %fakehash; - my $k; - for ($k = $self->FIRSTKEY(); defined $k; $k = $self->NEXTKEY($k)) { - $fakehash{$k} = undef; - } - $keylist{$self} = \%fakehash; -} +__END__ -sub EXISTS { - warn "Memoize::SDBM_File EXISTS (@_)\n" if $Verbose; - my $self = shift; - _backhash($self) unless exists $keylist{$self}; - my $r = exists $keylist{$self}{$_[0]}; - warn "Memoize::SDBM_File EXISTS (@_) ==> $r\n" if $Verbose; - $r; -} +=pod -sub DEFINED { - warn "Memoize::SDBM_File DEFINED (@_)\n" if $Verbose; - my $self = shift; - _backhash($self) unless exists $keylist{$self}; - defined $keylist{$self}{$_[0]}; -} +=head1 NAME -sub DESTROY { - warn "Memoize::SDBM_File DESTROY (@_)\n" if $Verbose; - my $self = shift; - delete $keylist{$self}; # So much for reference counting... - $self->SUPER::DESTROY(@_); -} +Memoize::SDBM_File - DEPRECATED compability shim -# Maybe establish the keylist at TIEHASH time instead? +=head1 DESCRIPTION -sub STORE { - warn "Memoize::SDBM_File STORE (@_)\n" if $VERBOSE; - my $self = shift; - $keylist{$self}{$_[0]} = undef; - $self->SUPER::STORE(@_); -} +This class used to provide L<EXISTS|perltie/C<EXISTS>> support for L<SDBM_File> +before support for C<EXISTS> was added to L<SDBM_File> itself +L<in Perl 5.6.0|perl56delta/SDBM_File>. -# Inherit FETCH and TIEHASH +Any code still using this class should be rewritten to use L<SBDM_File> directly. -1; +=cut |