File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -304,30 +304,31 @@ sub parent {
304
304
sub sort {
305
305
my $self = shift ;
306
306
307
- my $sort = sub { sort @_ };
308
-
309
- return $sort unless $self -> config()-> {' use_natural_sort' };
310
-
311
307
# if the user has asked for natural sorting we need to include an extra
312
308
# module
313
- if ( $self -> config()-> {' use_natural_sort' } ) {
309
+ my $config = $self -> config();
310
+
311
+ # Make sure the configuration object has been set correctly before
312
+ # referencing anything
313
+ if ( ref $config eq " HASH" && $config -> {' use_natural_sort' } ) {
314
314
eval { Module::Load::load(' Sort::Naturally' ); };
315
315
if ($@ ) {
316
316
warn (
317
317
" natural sorting requested but unable to load Sort::Naturally: $@ \n "
318
318
);
319
319
}
320
320
else {
321
- $sort = sub { Sort::Naturally::nsort(@_ ) };
321
+ my $sort = sub { Sort::Naturally::nsort(@_ ) };
322
+ return $sort ;
322
323
}
323
324
}
324
325
326
+ my $sort = sub { sort @_ };
325
327
return $sort ;
326
328
}
327
329
328
330
1;
329
331
330
-
331
332
=head1 METHODS
332
333
333
334
These extra methods are provided on the object
You can’t perform that action at this time.
0 commit comments