summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-01-22 17:01:35 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-01-22 17:01:35 +0100
commitd96f1f181d99da6cdab18bf22fe2ed70d73b81d3 (patch)
tree4f1caf49c1d2f0478c71cc5f80665f9600a8da4a
parentb4af56d0a726803cf17b73529646770a5afa89f3 (diff)
downloadbin-d96f1f181d99da6cdab18bf22fe2ed70d73b81d3.tar.gz
bin-d96f1f181d99da6cdab18bf22fe2ed70d73b81d3.tar.xz
borg-restore.pl: Fix perlcritic warnings
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xborg-restore.pl19
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');