KiokuDB::Cmd::Command::Dump - Dump database entries for backup or munging purposes
# command line API # dump whole database to foo.yml sequentially % kiokudump --verbose --file foo.yml --format yaml --backup --dsn bdb-gin:dir=data/ # programmatic API use KiokuDB::Cmd::Command::Dump; my $dumper = KiokuDB::Cmd::Command::Dump->new( backend => $backend, formatter => sub { ... }, output_handle => $fh, ); $dumper->run;
Using the KiokuDB::Backend::Role::Scan interface, any supporting backend can be dumped using this api.
The data can then be edited or simply retained for backup purposes.
The data can be loaded using KiokuDB::Cmd::Command::Load.
This class uses MooseX::Getopt to provide a command line api.
The command line options map to the class attributes.
Provided by MooseX::Getopt. Parses attributes init args from @ARGV.
@ARGV
Performs the actual dump.
The backend to be dumped.
dsn is a string and thus can be used on the command line. backend is defined in terms of dsn if it isn't provided.
dsn
backend
format is one of yaml, storable or json, defaulting to yaml.
format
yaml
storable
json
formatter is a code reference which takes an entry as an argument. It is created from a set of defaults using format if it isn't provided.
formatter
output_handle is where the returned string of formatter will be printed.
output_handle
If it isn't provided, file will be opened for writing. If the file already exists and force is specified, it will be overwritten. If backup is provided the original will first be renamed using backup_ext (defaults to .bak). If the backup already exists, then force will allow overwriting of the previous backup.
file
force
backup
backup_ext
.bak
If no file is provided then STDOUT is used.
STDOUT
If enabled causes progress information to be printed to STDERR.
STDERR
To install KiokuDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm KiokuDB
CPAN shell
perl -MCPAN -e shell install KiokuDB
For more information on module installation, please visit the detailed CPAN module installation guide.