summaryrefslogtreecommitdiff
path: root/lib/AniDB/Manager.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AniDB/Manager.pm')
-rw-r--r--lib/AniDB/Manager.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/AniDB/Manager.pm b/lib/AniDB/Manager.pm
index 0539c07..078946c 100644
--- a/lib/AniDB/Manager.pm
+++ b/lib/AniDB/Manager.pm
@@ -4,7 +4,6 @@ use experimental 'signatures';
use Moo;
use Log::Any '$log';
use Path::Tiny;
-use AniDB::Hashing;
use namespace::clean;
has datastore => (
@@ -44,6 +43,16 @@ sub _build_renamer {
return AniDB::Renamer->new();
}
+has hash_function => (
+ is => 'ro',
+ lazy => 1,
+);
+
+sub _build_hash_function {
+ require AniDB::Hashing;
+ return \&AniDB::Hashing::hash_fd;
+}
+
sub new_name_for($self,$path) {
$path = path($path)->realpath;
$self->update($path);
@@ -80,7 +89,7 @@ sub update($self,$path) {
return unless $self->datastore->has_changed($path,$stat);
- my $hash = AniDB::Hashing::hash_fd($path->openr_raw);
+ my $hash = $self->hash_function->($path->openr_raw);
$self->datastore->update_path_info(
$path => my $path_info = {