| 1 | package App::SimpleBackuper; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 0 | ▶ | sub BackupDB { | ||||||||
|
Subroutine
BackupDB: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 7 | 0 | my($options, $state) = @_; | |||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | print "Backuping database...\t" if $options->{verbose}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 10 | |||||||||||
| 11 | my $db_file = App::SimpleBackuper::RegularFile->new( | ||||||||||
| 12 | $options->{db}, | ||||||||||
| 13 | 0 | {%$options, compression_level => 5}, | |||||||||
| 14 | ); | ||||||||||
| 15 | 0 | $db_file->data_ref( $state->{db}->dump() ); | |||||||||
| 16 | |||||||||||
| 17 | 0 | $db_file->compress(); | |||||||||
| 18 | 0 | $db_file->write(); | |||||||||
| 19 | |||||||||||
| 20 | 0 | my($key, $iv) = $db_file->gen_keys(); | |||||||||
| 21 | 0 | $db_file->encrypt( $key, $iv ); | |||||||||
| 22 | |||||||||||
| 23 | 0 | $state->{storage}->put(db => $db_file->data_ref); | |||||||||
| 24 | |||||||||||
| 25 | 0 | my $db_key = $state->{rsa}->encrypt(pack("a32a16", $key, $iv)); | |||||||||
| 26 | |||||||||||
| 27 | 0 | $state->{storage}->put('db.key' => \$db_key); | |||||||||
| 28 | |||||||||||
| 29 | 0 | ▶ | print "done.\n" if $options->{verbose}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | } | ||||||||||
| 31 | |||||||||||
| 32 | 1 | 1; | |||||||||