1 package Blerg::Database;
11 our @ISA = qw(Exporter);
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
17 # This allows declaration use Blerg::Database ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20 our %EXPORT_TAGS = ( 'all' => [ qw(
24 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
33 # This AUTOLOAD is used to 'autoload' constants from the constant()
38 ($constname = $AUTOLOAD) =~ s/.*:://;
39 croak "&Blerg::Database::constant not defined" if $constname eq 'constant';
40 my ($error, $val) = constant($constname);
41 if ($error) { croak $error; }
44 # Fixed between 5.005_53 and 5.005_61
45 #XXX if ($] >= 5.00561) {
46 #XXX *$AUTOLOAD = sub () { $val };
49 *$AUTOLOAD = sub { $val };
56 XSLoader::load('Blerg::Database', $VERSION);
58 # Preloaded methods go here.
61 my ($class, $name) = @_;
62 my $ptr = Blerg::Database::_open($name);
66 return bless $obj, $class;
70 my ($class, $name) = @_;
72 if (Blerg::Database::exists($name)) {
73 return Blerg::Database::open($name);
80 if (!defined $obj->{ptr}) {
81 croak "Attempted to use closed Blerg::Database";
87 $obj->_ensure_pointer;
88 Blerg::Database::_close($obj->{ptr});
98 my ($obj, $data) = @_;
99 $obj->_ensure_pointer;
100 return Blerg::Database::_store($obj->{ptr}, $data);
104 my ($obj, $record) = @_;
105 $obj->_ensure_pointer;
106 return Blerg::Database::_fetch($obj->{ptr}, $record);
109 # Autoload methods go after =cut, and are processed by the autosplit program.
113 # Below is stub documentation for your module. You'd better edit it!
117 Blerg::Database - Perl extension for blah blah blah
126 Stub documentation for Blerg::Database, created by h2xs. It looks like the
127 author of the extension was negligent enough to leave the stub
143 Original version; created by h2xs 1.23 with options
159 Mention other useful documentation such as the documentation of
160 related modules or operating system documentation (such as man pages
161 in UNIX), or any relevant external documentation such as RFCs or
164 If you have a mailing list set up for your module, mention it here.
166 If you have a web site set up for your module, mention it here.
170 Chip Black, E<lt>bytex64@bytex64.netE<gt>
172 =head1 COPYRIGHT AND LICENSE
174 Copyright (C) 2013 by Chip Black
176 This library is free software; you can redistribute it and/or modify
177 it under the same terms as Perl itself, either Perl version 5.16.1 or,
178 at your option, any later version of Perl 5 you may have available.