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