From 40b675d89f6842da2bac7d503ee4154d20abe412 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 3 Mar 2017 00:15:29 +0100 Subject: Support dependency injection of Borg class Signed-off-by: Florian Pritz --- lib/App/BorgRestore/Borg.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/App/BorgRestore/Borg.pm') 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; -- cgit v1.2.3-24-g4f1b