avoid crashing if Sort::Naturally is not installed

master
Joey Hess 2009-03-19 15:35:57 -04:00
parent 55b83cb7bd
commit bb258b56b2
1 changed files with 4 additions and 1 deletions

View File

@ -195,7 +195,10 @@ sub preprocess_inline (@) {
@list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list; @list=sort { pagetitle(basename($a)) cmp pagetitle(basename($b)) } @list;
} }
elsif (exists $params{sort} && $params{sort} eq 'title_natural') { elsif (exists $params{sort} && $params{sort} eq 'title_natural') {
require Sort::Naturally; eval q{use Sort::Naturally};
if ($@) {
error(gettext("Sort::Naturally needed for title_natural sort"));
}
@list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list; @list=sort { Sort::Naturally::ncmp(pagetitle(basename($a)), pagetitle(basename($b))) } @list;
} }
elsif (exists $params{sort} && $params{sort} eq 'mtime') { elsif (exists $params{sort} && $params{sort} eq 'mtime') {