Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

linuxkid's scratchpad

by linuxkid (Sexton)
on Mar 03, 2012 at 04:41 UTC ( #957600=scratchpad: print w/ replies, xml ) Need Help??

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); }

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (16)
As of 2015-01-29 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (244 votes), past polls