NAME

DB::SimpleKV - Simple k/v interface to text configuration file

VERSION

Version 0.01

SYNOPSIS

This module is mainly used to manipulate a configuration file like Postfix's main.cf

It creates the default db file under "/tmp/simplekv.db".

use DB::SimpleKV;

my $db = DB::SimpleKV->new;
$db->set("hostname","h99.foo.com");
$db->set("provider","rackspace cloud");
$db->set("ip_addr","192.168.2.10");
$db->set("netmask","255.255.255.0");

print $db->get("provider"),"\n";
$db->delete("netmask");
print  "netmask exists? ", $db->exists("netmask") ? "yes" : "no", "\n";

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/postfix/main.cf");
print $db->get("relayhost"),"\n";
print  "relay exists? ", $db->exists("relayhost") ? "yes" : "no", "\n";

SUBROUTINES/METHODS

new

my $db = DB::SimpleKV->new(...);

get

my $value = $db->get("key");

set

$db->set("key","value");

delete

$db->delete("key");

exists

my $exists = $db->exists("key");

AUTHOR

Ken Peng, <yhpeng at cpan.org>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc DB::SimpleKV

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by Ken Peng.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)