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 ; |
02c45c47 |
10 | tie %hash, 'GDBM_File', $filename, &GDBM_WRCREAT, 0640; |
4633a7c4 |
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 | |
16c2cc08 |
25 | gdbm is available from any GNU archive. The master site is |
26 | C<ftp.gnu.org>, but you are strongly urged to use one of the many |
27 | mirrors. You can obtain a list of mirror sites from |
28 | http://www.gnu.org/order/ftp.html. |
4633a7c4 |
29 | |
30 | =head1 BUGS |
31 | |
32 | The available functions and the gdbm/perl interface need to be documented. |
33 | |
6c8d78fb |
34 | The GDBM error number and error message interface needs to be added. |
35 | |
4633a7c4 |
36 | =head1 SEE ALSO |
37 | |
9fe6733a |
38 | L<perl(1)>, L<DB_File(3)>, L<perldbmfilter>. |
4633a7c4 |
39 | |
40 | =cut |
41 | |
a0d0e21e |
42 | package GDBM_File; |
43 | |
96318ac8 |
44 | use strict; |
698828ad |
45 | use warnings; |
17f410f9 |
46 | our($VERSION, @ISA, @EXPORT, $AUTOLOAD); |
96318ac8 |
47 | |
a0d0e21e |
48 | require Carp; |
96318ac8 |
49 | require Tie::Hash; |
a0d0e21e |
50 | require Exporter; |
9426adcd |
51 | use XSLoader (); |
52 | @ISA = qw(Tie::Hash Exporter); |
a0d0e21e |
53 | @EXPORT = qw( |
54 | GDBM_CACHESIZE |
6c8d78fb |
55 | GDBM_CENTFREE |
56 | GDBM_COALESCEBLKS |
a0d0e21e |
57 | GDBM_FAST |
6c8d78fb |
58 | GDBM_FASTMODE |
a0d0e21e |
59 | GDBM_INSERT |
60 | GDBM_NEWDB |
8722d079 |
61 | GDBM_NOLOCK |
6c8d78fb |
62 | GDBM_OPENMASK |
a0d0e21e |
63 | GDBM_READER |
64 | GDBM_REPLACE |
6c8d78fb |
65 | GDBM_SYNC |
66 | GDBM_SYNCMODE |
a0d0e21e |
67 | GDBM_WRCREAT |
68 | GDBM_WRITER |
69 | ); |
70 | |
f84167b3 |
71 | $VERSION = "1.08_01"; |
a5d81eb5 |
72 | $VERSION = eval $VERSION; # Needed for dev versions |
c07a80fd |
73 | |
a0d0e21e |
74 | sub AUTOLOAD { |
96318ac8 |
75 | my($constname); |
a0d0e21e |
76 | ($constname = $AUTOLOAD) =~ s/.*:://; |
97a5fa0b |
77 | my ($error, $val) = constant($constname); |
78 | Carp::croak $error if $error; |
57c77851 |
79 | no strict 'refs'; |
80 | *{$AUTOLOAD} = sub { $val }; |
81 | goto &{$AUTOLOAD}; |
a0d0e21e |
82 | } |
83 | |
9426adcd |
84 | XSLoader::load 'GDBM_File', $VERSION; |
a0d0e21e |
85 | |
a0d0e21e |
86 | 1; |