KiokuDB::Cmd::Load - Load database dumps
# command line API # dump whole database to foo.yml sequentially % kiokuload --verbose --file foo.yml --format yaml --clear --dsn bdb-gin:dir=data/ # programmatic API use KiokuDB::Cmd::Load; my $loader = KiokuDB::Cmd::Load->new( backend => $backend, formatter => sub { ... }, input_handle => $fh, ); $dumper->run;
This class loads dumps created by KiokuDB::Cmd::Dump.
Entries will be read sequentially from input_handle, deserialized, and inserted into the database.
input_handle
If the backend supports KiokuDB::Backend::TXN then the load is performed in a single transaction.
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 load.
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 that is provided with a file handle and should return at least one entry object.
formatter
It is applied to the handle repeatedly until no more entries are returned.
If set, KiokuDB::Backend::Clear's interface will be used to wipe the database before loading.
input_handle is where entries will be read from.
If it isn't provided and then file will be opened for reading.
file
If file isn't provided STDIN will be used.
STDIN
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.