From 5c6f506ed95bb44773cd8ebbe09f55324123aa9f Mon Sep 17 00:00:00 2001 From: Dan Church Date: Thu, 20 Jul 2023 12:48:07 -0500 Subject: [PATCH] Refactor 'oldest_mtime' to be static --- lib/Directory/Simplify/Instruction/Generator.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Directory/Simplify/Instruction/Generator.pm b/lib/Directory/Simplify/Instruction/Generator.pm index 4f6c2ac..fdbd1d8 100644 --- a/lib/Directory/Simplify/Instruction/Generator.pm +++ b/lib/Directory/Simplify/Instruction/Generator.pm @@ -87,11 +87,12 @@ sub _entries_are_hard_linkable { return 0; } -sub oldest_mtime { - my $self = shift; - return sort { +sub _oldest_mtime { + my @entries = @_; + my @sorted = sort { $a->{mtime} <=> $b->{mtime} - } @_; + } @entries; + return @sorted; } sub more_linked { @@ -149,7 +150,7 @@ sub instructions { foreach my $bucket ($self->buckets) { # of the bucket, find the oldest timestamp - my ($oldest_entry) = $self->oldest_mtime(@{$bucket}); + my ($oldest_entry) = _oldest_mtime(@{$bucket}); # of the bucket, find the file most embedded in the file system my @to_link = $self->more_linked(@{$bucket});