Take me over?
NAME
KiokuDB::Cmd::Command::Dump - Dump database entries for backup or munging purposes
SYNOPSIS
# 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;
DESCRIPTION
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.
COMMAND LINE API
This class uses MooseX::Getopt to provide a command line api.
The command line options map to the class attributes.
METHODS
- new_with_options
-
Provided by MooseX::Getopt. Parses attributes init args from
@ARGV. - run
-
Performs the actual dump.
ATTRIBUTES
- dsn
- backend
-
The backend to be dumped.
dsnis a string and thus can be used on the command line.backendis defined in terms ofdsnif it isn't provided. - format
- formatter
-
formatis one ofyaml,storableorjson, defaulting toyaml.formatteris a code reference which takes an entry as an argument. It is created from a set of defaults usingformatif it isn't provided. - file
- backup
- force
- backup_ext
- output_handle
-
output_handleis where the returned string offormatterwill be printed.If it isn't provided,
filewill be opened for writing. If the file already exists andforceis specified, it will be overwritten. Ifbackupis provided the original will first be renamed usingbackup_ext(defaults to.bak). If the backup already exists, thenforcewill allow overwriting of the previous backup.If no file is provided then
STDOUTis used. - verbose
-
If enabled causes progress information to be printed to
STDERR.