Commit | Line | Data |
a0d0e21e |
1 | package GDBM_File; |
2 | |
3 | require Carp; |
4 | require TieHash; |
5 | require Exporter; |
6 | require AutoLoader; |
7 | require DynaLoader; |
3edbfbe5 |
8 | @ISA = (TieHash, Exporter, DynaLoader); |
a0d0e21e |
9 | @EXPORT = qw( |
10 | GDBM_CACHESIZE |
11 | GDBM_FAST |
12 | GDBM_INSERT |
13 | GDBM_NEWDB |
14 | GDBM_READER |
15 | GDBM_REPLACE |
16 | GDBM_WRCREAT |
17 | GDBM_WRITER |
18 | ); |
19 | |
20 | sub AUTOLOAD { |
21 | if (@_ > 1) { |
22 | $AutoLoader::AUTOLOAD = $AUTOLOAD; |
23 | goto &AutoLoader::AUTOLOAD; |
24 | } |
25 | local($constname); |
26 | ($constname = $AUTOLOAD) =~ s/.*:://; |
27 | $val = constant($constname, @_ ? $_[0] : 0); |
28 | if ($! != 0) { |
29 | if ($! =~ /Invalid/) { |
30 | $AutoLoader::AUTOLOAD = $AUTOLOAD; |
31 | goto &AutoLoader::AUTOLOAD; |
32 | } |
33 | else { |
34 | Carp::croak("Your vendor has not defined GDBM_File macro $constname, used"); |
35 | } |
36 | } |
37 | eval "sub $AUTOLOAD { $val }"; |
38 | goto &$AUTOLOAD; |
39 | } |
40 | |
41 | bootstrap GDBM_File; |
42 | |
43 | # Preloaded methods go here. Autoload methods go after __END__, and are |
44 | # processed by the autosplit program. |
45 | |
46 | 1; |
47 | __END__ |