LARC::DB - Provides a methode for storing SQLite DBs in a pleasantly organized manner.
Version 0.0.0
use LARC::DB; my $ldb = LARC::DB->new();
Initializes the module. No arguements are taken. No arguements are required.
my $ldb = LARC::DB->new();
This generates to a SQLite DB connecting and returns a DBI object.
my $dbh=$ldb->connect('some/DB'); if($ldb->{error}){ print "ERROR!"; }
Checks if a database exists or not. One one option is accepted and that is the DB name.
my $returned=$ldb->DBexists('foo/bar'); if($ldb->{error}){ print 'Error:'.$ldb->{error}.':'.$error->{errorString}; } if($returned){ print 'It exists'; }
This initiliazes the support stuff for it all. It currently just creates '~/larc/DB/' if needed.
$ldb->init(); if($ldb->{error}){ print "ERROR!"; }
List DBs under a specific path. The returned value is an array.
Any thing ending in '/' is a directory. If something is both a directory and DB, both an entry for the DB and directory is listed.
Any thing beginning with an '.' is not returned.
my @DBs=$ldb->list('some/'); if($ldb->{error}){ print "ERROR!"; }
Creates a new DB.
$ldb->newdb('some/DB'); if($ldb->{error}){ print "ERROR!"; }
Removes a DB.
$ldb->rmdb('some/DB'); if($ldb->{error}){ print "ERROR!"; }
This checks if a DB name is valid or not.
if($returned=$ldb->validname('some/DB')){ print 'Invalid name'. }
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef; $self->{errorString}="";
The base dir used is '$ENV{HOME}/larc/DB/'. The specified DB is then tacked onto that as a path with '.sqlite' appended to the end. So the DB 'foo/bar' then becomes '$ENV{HOME}/larc/DB/foo/bar.sqlite'. This allows a DB to have sub DBs in regards to how the path looks.
A DB may not begin with '.' or have that any were after an '/'. Thus the following are all invalid.
./someDB some/.DB some/.something/DB
The base directory, '~/larc/DB/', does exists, but is not a directory.
The enviromental variable 'HOME' is not defined.
Failed to create the directory '~/larc' or '~/larc/DB';
The database does not exist.
Failed to create the new SQLite file.
The DB already exists.
Reservered for future use.
Failed to unlink a DB file.
Failed to remove the specified directory.
Mkpath failed.
The specified DB is not also a directory.
Invalid DB name.
Opendir error.
Zane C. Bowers, <vvelox at vvelox.net>
<vvelox at vvelox.net>
Please report any bugs or feature requests to bug-larc-db at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=LARC-DB. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-larc-db at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc LARC::DB
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=LARC-DB
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/LARC-DB
CPAN Ratings
http://cpanratings.perl.org/d/LARC-DB
Search CPAN
http://search.cpan.org/dist/LARC-DB
Copyright 2008 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install LARC::DB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LARC::DB
CPAN shell
perl -MCPAN -e shell install LARC::DB
For more information on module installation, please visit the detailed CPAN module installation guide.