summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-03-03 00:15:29 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-03-03 00:20:55 +0100
commit40b675d89f6842da2bac7d503ee4154d20abe412 (patch)
tree9129dff70d9c68277f473b90abe959eb8b260e77 /lib/App/BorgRestore
parentea7b9ccd31eda9ec803cebe3e29509a9458757b5 (diff)
downloadApp-BorgRestore-40b675d89f6842da2bac7d503ee4154d20abe412.tar.gz
App-BorgRestore-40b675d89f6842da2bac7d503ee4154d20abe412.tar.xz
Support dependency injection of Borg class
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r--lib/App/BorgRestore/Borg.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm
index 426f809..ebedb7d 100644
--- a/lib/App/BorgRestore/Borg.pm
+++ b/lib/App/BorgRestore/Borg.pm
@@ -5,7 +5,17 @@ use strict;
use IPC::Run qw(run start);
+sub new {
+ my $class = shift;
+
+ my $self = {};
+ bless $self, $class;
+
+ return $self;
+}
+
sub borg_list {
+ my $self = shift;
my @archives;
run [qw(borg list)], '>', \my $output or die "borg list returned $?";
@@ -20,6 +30,7 @@ sub borg_list {
}
sub restore {
+ my $self = shift;
my $components_to_strip = shift;
my $archive_name = shift;
my $path = shift;
@@ -28,6 +39,7 @@ sub restore {
}
sub list_archive {
+ my $self = shift;
my $archive = shift;
my $fh = shift;