Hierarchical DB System
Still Some work to do, but it's almost done.

#!/usr/bin/perl use YAML::Tiny; $iparse = YAML::Tiny->new(); %dbs; $dbtouse; %hoc = ( open => \&opendb, cdb => \$cdb, use => \&cdb, get => \&retrieve, retrieve => \&retrieve, value => \&setval, set => \&setval, save => \&save, quit => sub {exit;}, exit => sub {exit;}, ); print '`: ' if(not defined $ARGV[0]); COMMAND: while(<>) { chop($line = <STDIN>); ($command, @args) = split / /, $line; $args = join ' ', @args; $command = lc $command; if(defined $hoc{$command}) { $hoc{$command}->(@args); } else { print "ERROR: $command unknown!\n"; } print '`: ' if(not defined $ARGV[0]); next COMMAND; } sub opendb { $file = shift; $name = shift; $dbs{$name} = $iparse->read($file); } sub cdb { $name = shift; $dbtouse = \$dbs{$name}; } sub retrieve { } sub setval { } sub save { $file = shift; $dbtouse->write($file); }
[download]