DB::SimpleKV - Simple k/v interface to text configuration file
Version 0.18
This module is mainly used to manipulate a configuration file like Postfix's main.cf.
If you find any issues in using the module, please don't hesitate to email me: pyh@gmx.fr
It creates the default db file "/tmp/simplekv.db" if you don't specify the file path.
use DB::SimpleKV; my $db = DB::SimpleKV->new; $db->set("hostname","h99.foo.com"); $db->set("provider","rackspace cloud"); $db->set("tags","cloud,virtual,kvm"); print $db->get("provider"),"\n"; $db->delete("tags"); print "tags exists? ", $db->exists("tags") ? "yes" : "no", "\n"; $db->save;
Or you can specify the existing file for manipulation, one configuration per line, with '=' as delimiter.
use DB::SimpleKV; my $db = DB::SimpleKV->new("/etc/lsb-release"); print "My OS is: ", $db->get("DISTRIB_ID");
my $db = DB::SimpleKV->new(...);
If a file path was given, the delimiter in each line should be '='.
my $value = $db->get("key");
Get the value by key.
$db->set("key","value");
Set the key and value, either create them or update them.
$db->delete("key");
Delete the key and value.
if ($db->exists("key") ) {...}
To check if there is a key existing while the value can be undefined.
$db->save;
If db has been changed, should be written to disk finally.
Ken Peng, <yhpeng at cpan.org>
<yhpeng at cpan.org>
Please report any bugs or feature requests to bug-db-simplekv at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=DB-SimpleKV. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-db-simplekv at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc DB::SimpleKV
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=DB-SimpleKV
CPAN Ratings
https://cpanratings.perl.org/d/DB-SimpleKV
Search CPAN
https://metacpan.org/release/DB-SimpleKV
This software is Copyright (c) 2022 by Ken Peng.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install DB::SimpleKV, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB::SimpleKV
CPAN shell
perl -MCPAN -e shell install DB::SimpleKV
For more information on module installation, please visit the detailed CPAN module installation guide.