summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/BorgRestore/Helper.pm13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/App/BorgRestore/Helper.pm b/lib/App/BorgRestore/Helper.pm
index 8bc4ceb..976ef54 100644
--- a/lib/App/BorgRestore/Helper.pm
+++ b/lib/App/BorgRestore/Helper.pm
@@ -3,24 +3,19 @@ use v5.10;
use strict;
use warnings;
+use Function::Parameters;
use POSIX ();
-sub untaint {
- my $data = shift;
- my $regex = shift;
-
+fun untaint($data, $regex) {
$data =~ m/^($regex)$/ or die "Failed to untaint: $data";
return $1;
}
-sub untaint_archive_name {
- my $archive = shift;
+fun untaint_archive_name($archive) {
return untaint($archive, qr([a-zA-Z0-9-:+\.]+));
}
-sub format_timestamp {
- my $timestamp = shift;
-
+fun format_timestamp($timestamp) {
return POSIX::strftime "%a. %F %H:%M:%S %z", localtime $timestamp;
}