1use strict; use warnings; 2 3package Memoize::NDBM_File; 4our $VERSION = '1.16'; 5 6use NDBM_File; 7our @ISA = qw(NDBM_File); 8 9# NDBM_File cannot store undef and will store an empty string if you try 10# but it does return undef if you try to read a non-existent key 11# so we can emulate exists() using defined() 12sub EXISTS { 13 defined shift->FETCH(@_); 14} 15 16# Perl 5.37.3 adds this EXISTS emulation to NDBM_File itself 17delete $Memoize::NDBM_File::{'EXISTS'} 18 if eval { NDBM_File->VERSION( '1.16' ) }; 19 201; 21 22__END__ 23 24=pod 25 26=head1 NAME 27 28Memoize::NDBM_File - glue to provide EXISTS for NDBM_File for Storable use 29 30=head1 DESCRIPTION 31 32This class provides L<EXISTS|perltie/C<EXISTS>> support for L<NDBM_File>. 33 34L<In Perl 5.37.3|https://github.com/Perl/perl5/commit/c0a1a377c02ed789f5eff667f46a2314a05c5a4c>, 35support for C<EXISTS> was added to L<NDBM_File> itself. 36Code which requires such a perl should simply use L<NBDM_File> directly. 37 38=cut 39