summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/App/BorgRestore.pm12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/App/BorgRestore.pm b/lib/App/BorgRestore.pm
index a8d3d5d..d90afe2 100644
--- a/lib/App/BorgRestore.pm
+++ b/lib/App/BorgRestore.pm
@@ -90,16 +90,13 @@ L<App::BorgRestore::DB>
=cut
method new($class: $deps = {}) {
- my $self = {};
- bless $self, $class;
-
my $db_path = App::BorgRestore::Settings::get_db_path();
my $cache_size = $App::BorgRestore::Settings::sqlite_cache_size;
- $self->{deps}->{borg} = $deps->{borg} // App::BorgRestore::Borg->new($App::BorgRestore::Settings::borg_repo);
- $self->{deps}->{db} = $deps->{db} // App::BorgRestore::DB->new($db_path, $cache_size);
+ $deps->{borg} //= App::BorgRestore::Borg->new($App::BorgRestore::Settings::borg_repo);
+ $deps->{db} //= App::BorgRestore::DB->new($db_path, $cache_size);
- return $self;
+ return $class->new_no_defaults($deps);
}
=head3 new_no_defaults
@@ -113,8 +110,7 @@ method new_no_defaults($class: $deps) {
my $self = {};
bless $self, $class;
- $self->{deps}->{borg} = $deps->{borg};
- $self->{deps}->{db} = $deps->{db};
+ $self->{deps} = $deps;
return $self;
}