diff options
Diffstat (limited to 'borg-restore.pl')
-rwxr-xr-x | borg-restore.pl | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/borg-restore.pl b/borg-restore.pl index e5abf3a..b16a0d2 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -171,7 +171,7 @@ sub user_select_archive { my $counter = 0; if (!@$archives) { - return undef; + return; } for my $archive (@$archives) { @@ -180,10 +180,10 @@ sub user_select_archive { printf "\e[0;34m%s: \e[0m", "Enter ID to restore (Enter to skip)"; my $selection = <STDIN>; - return undef if !defined($selection); + return if !defined($selection); chomp $selection; - return undef unless ($selection =~ /^\d+$/ && defined(${$archives}[$selection])); + return unless ($selection =~ /^\d+$/ && defined(${$archives}[$selection])); return ${$archives}[$selection]; } @@ -194,7 +194,7 @@ sub select_archive_timespec { my $seconds = timespec_to_seconds($timespec); if (!defined($seconds)) { say STDERR "Error: Invalid time specification"; - return undef; + return; } my $target_timestamp = time - $seconds; @@ -207,7 +207,7 @@ sub select_archive_timespec { } } - return undef; + return; } sub format_timestamp { @@ -250,7 +250,7 @@ sub timespec_to_seconds { } } - return undef; + return; } sub restore { @@ -429,7 +429,7 @@ sub build_archive_cache { my $db_path = get_cache_path('archives.db'); # ensure the cache directory exists - mkpath(get_cache_dir(), {mode => 0700}); + mkpath(get_cache_dir(), {mode => oct(700)}); if (! -f $db_path) { debug("Creating initial database"); @@ -485,7 +485,7 @@ sub get_mtime_from_lookuptable { for my $component (@components) { $node = $$node[0]->{$component}; if (!defined($node)) { - return undef; + return; } } return $$node[1]; @@ -650,7 +650,6 @@ sub add_archive_name { $st->execute($archive); $self->_add_column_to_table("files", $archive); - } sub _add_column_to_table { @@ -677,7 +676,7 @@ sub remove_archive { $self->_add_column_to_table("files_new", $archive); } - my @columns_to_copy = map {$_ = '`'._prefix_archive_id($_).'`'} @keep_archives; + my @columns_to_copy = map {'`'._prefix_archive_id($_).'`'} @keep_archives; @columns_to_copy = ('`path`', @columns_to_copy); $self->{dbh}->do('insert into `files_new` select '.join(',', @columns_to_copy).' from files'); |