Bot-Cobalt-DB-Term
view release on metacpan or search on metacpan
lib/Bot/Cobalt/DB/Term.pm view on Meta::CPAN
}
$db->dbclose;
unless (@result) {
print $o "No results.\n";
return
}
print $o $_."\n" for sort @result;
my $count = scalar @result;
print $o "($count results found)\n";
}
1;
__END__
=pod
=head1 NAME
Bot::Cobalt::DB::Term - Bot::Cobalt::DB terminal interface
=head1 SYNOPSIS
$ cobalt2-dbterm
## Or via Perl:
Bot::Cobalt::DB::Term->new->interactive;
=head1 DESCRIPTION
A simple L<Term::UI>-based interface allowing interaction with
L<Bot::Cobalt::DB> databases.
Also allows interaction with L<Bot::Cobalt::Serializer> via
L</thaw> and L</freeze>.
(For complete functionality you'll probably want L<Term::ReadLine::Gnu>,
or at least L<Term::ReadLine::Perl>.)
=head1 COMMANDS
Command arguments can be quoted.
=head2 help
Retrieve command line help.
=head2 quit
Exit.
=head2 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 C<open>.
=head2 create
Create and open a new database at the specified location.
=head2 current
Display the path to the currently-selected database.
=head2 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.
=head2 get
Get the raw value for a specified key.
=head2 getref
Display the deserialiazed reference for a specified key.
L<Bot::Cobalt::DB> databases usually store values as serialized
references; C<getref> will use L<Data::Dumper> to display the
data structure that would be created by deserializing.
=head2 put
put KEY DATA ...
Add raw data to the specified key.
(You can, of course, horribly break your database this way, if you like.)
=head2 putref
putref KEY PERLDATA ...
Add a serialized reference to the specified key.
For example:
putref MyKey { Some => 'Hash', Array => [ ] }
putref MyArr [ 'A', 'B', 'C' ]
=head2 del
Deletes the specified key.
=head2 freeze
Freezes a Perl data structure via L<Bot::Cobalt::Serializer>.
( run in 2.155 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )