X-Git-Url: http://git.shiar.nl/perl/list-index.git/blobdiff_plain/0433a4eb785409f46a2d61e668fda84bd87c3148..d6c30ef4ef400982bc1b08e9b7bf93993ea29be5:/lib/List/Index.pm diff --git a/lib/List/Index.pm b/lib/List/Index.pm index 7214ced..c42db44 100644 --- a/lib/List/Index.pm +++ b/lib/List/Index.pm @@ -43,7 +43,7 @@ sub ranges { for my $i (0 .. $#links - 1) { my ($link, $lastchar) = $links[$i + 1]->[0] =~ /(.*)(.)/; - $link .= $lastchar eq '.' ? 'z' : chr( ord($lastchar) - 1 ) + $link .= $lastchar eq '.' ? 'a' : chr( ord($lastchar) - 1 ) unless $lastchar eq 'a'; $links[$i]->[1] = $link; } @@ -59,6 +59,10 @@ sub rangematch { my @allow; if (length $s1) { + if (length $s2) { + $s1 le $s2 or $s1 =~ /^\Q$s2/ or return undef; + } + my $prefix = ''; my $char; for my $i (0 .. length($s1) - 1) {