summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-04-10 23:16:49 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-04-10 23:16:49 +0200
commit5b8a11a94c506c0bb8bad2163094686b2710b34f (patch)
tree824c004f62ce72b6f6e4bfbdd6a528a6a6419534 /lib
parent2c8e59e9c0df286c6e01672acfb1f83e0fb728f0 (diff)
downloadApp-BorgRestore-5b8a11a94c506c0bb8bad2163094686b2710b34f.tar.gz
App-BorgRestore-5b8a11a94c506c0bb8bad2163094686b2710b34f.tar.xz
Use Function::Parameters in Helper package
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib')
-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;
}