Skip to content

Commit

Permalink
Fix hash reference error on perl > 5.38
Browse files Browse the repository at this point in the history
Fix a reference issue on hash variables which is now stricter on
later versions of perl
  • Loading branch information
Duncan Ferguson committed Oct 15, 2024
1 parent 4d34e53 commit 8787ab9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/App/ClusterSSH/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -304,30 +304,31 @@ sub parent {
sub sort {
my $self = shift;

my $sort = sub { sort @_ };

return $sort unless $self->config()->{'use_natural_sort'};

# if the user has asked for natural sorting we need to include an extra
# module
if ( $self->config()->{'use_natural_sort'} ) {
my $config = $self->config();

# Make sure the configuration object has been set correctly before
# referencing anything
if ( ref $config eq "HASH" && $config->{'use_natural_sort'} ) {
eval { Module::Load::load('Sort::Naturally'); };
if ($@) {
warn(
"natural sorting requested but unable to load Sort::Naturally: $@\n"
);
}
else {
$sort = sub { Sort::Naturally::nsort(@_) };
my $sort = sub { Sort::Naturally::nsort(@_) };
return $sort;
}
}

my $sort = sub { sort @_ };
return $sort;
}

1;


=head1 METHODS
These extra methods are provided on the object
Expand Down

0 comments on commit 8787ab9

Please sign in to comment.