Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

linuxkid's scratchpad

by linuxkid (Sexton)
on Mar 03, 2012 at 04:41 UTC ( [id://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
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found