NAME

Bot::Cobalt::DB::Term - Bot::Cobalt::DB terminal interface

SYNOPSIS

$ cobalt2-dbterm

## Or via Perl:
Bot::Cobalt::DB::Term->new->interactive;

DESCRIPTION

A simple Term::UI-based interface allowing interaction with Bot::Cobalt::DB databases.

Also allows interaction with Bot::Cobalt::Serializer via "thaw" and "freeze".

(For complete functionality you'll probably want Term::ReadLine::Gnu, or at least Term::ReadLine::Perl.)

COMMANDS

Command arguments can be quoted.

help

Retrieve command line help.

quit

Exit.

open

Open a specified database.

Required prior to specifying commands.

The database is opened to make sure it is valid, then unlocked again.

All other operations take place against whatever database was last opened via open.

create

Create and open a new database at the specified location.

current

Display the path to the currently-selected database.

keys

List or search database keys.

If no arguments are specified, the entire list of keys will be returned.

A regular expression can be specified as an argument.

get

Get the raw value for a specified key.

getref

Display the deserialiazed reference for a specified key.

Bot::Cobalt::DB databases usually store values as serialized references; getref will use Data::Dumper to display the data structure that would be created by deserializing.

put

put KEY DATA ...

Add raw data to the specified key.

(You can, of course, horribly break your database this way, if you like.)

putref

putref KEY PERLDATA ...

Add a serialized reference to the specified key.

For example:

putref MyKey { Some => 'Hash', Array => [ ] }
putref MyArr [ 'A', 'B', 'C' ]

del

Deletes the specified key.

freeze

Freezes a Perl data structure via Bot::Cobalt::Serializer.

For example:

freeze { Some => 'Hash' }

Defaults to JSON. A Bot::Cobalt::Serializer format can optionally be specified:

freeze --yaml { Some => 'Hash' }
freeze --xml  { Some => 'Hash' }

thaw

Thaws a serialized data structure and displays it via Data::Dumper.

AUTHOR

Jon Portnoy <avenj@cobaltirc.org>

http://www.cobaltirc.org