xref: /openbsd-src/gnu/usr.bin/perl/ext/GDBM_File/GDBM_File.pm (revision 62a742911104f98b9185b2c6b6007d9b1c36396c)
1# GDBM_File.pm -- Perl 5 interface to GNU gdbm library.
2
3=head1 NAME
4
5GDBM_File - Perl5 access to the gdbm library.
6
7=head1 SYNOPSIS
8
9    use GDBM_File ;
10    tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640);
11    # Use the %hash array.
12    untie %hash ;
13
14=head1 DESCRIPTION
15
16B<GDBM_File> is a module which allows Perl programs to make use of the
17facilities provided by the GNU gdbm library.  If you intend to use this
18module you should really have a copy of the gdbm manualpage at hand.
19
20Most of the libgdbm.a functions are available through the GDBM_File
21interface.
22
23=head1 AVAILABILITY
24
25Gdbm is available from any GNU archive.  The master site is
26C<prep.ai.mit.edu>, but your are strongly urged to use one of the many
27mirrors.   You can obtain a list of mirror sites by issuing the
28command	C<finger fsf@prep.ai.mit.edu>.
29
30=head1 BUGS
31
32The available functions and the gdbm/perl interface need to be documented.
33
34=head1 SEE ALSO
35
36L<perl(1)>, L<DB_File(3)>.
37
38=cut
39
40package GDBM_File;
41
42use strict;
43use vars qw($VERSION @ISA @EXPORT $AUTOLOAD);
44
45require Carp;
46require Tie::Hash;
47require Exporter;
48use AutoLoader;
49require DynaLoader;
50@ISA = qw(Tie::Hash Exporter DynaLoader);
51@EXPORT = qw(
52	GDBM_CACHESIZE
53	GDBM_FAST
54	GDBM_INSERT
55	GDBM_NEWDB
56	GDBM_READER
57	GDBM_REPLACE
58	GDBM_WRCREAT
59	GDBM_WRITER
60);
61
62$VERSION = "1.00";
63
64sub AUTOLOAD {
65    my($constname);
66    ($constname = $AUTOLOAD) =~ s/.*:://;
67    my $val = constant($constname, @_ ? $_[0] : 0);
68    if ($! != 0) {
69	if ($! =~ /Invalid/) {
70	    $AutoLoader::AUTOLOAD = $AUTOLOAD;
71	    goto &AutoLoader::AUTOLOAD;
72	}
73	else {
74	    Carp::croak("Your vendor has not defined GDBM_File macro $constname, used");
75	}
76    }
77    eval "sub $AUTOLOAD { $val }";
78    goto &$AUTOLOAD;
79}
80
81bootstrap GDBM_File $VERSION;
82
83# Preloaded methods go here.  Autoload methods go after __END__, and are
84# processed by the autosplit program.
85
861;
87__END__
88