--- deliantra/Deliantra-Client/DC/Pod.pm 2008/03/30 11:31:09 1.22 +++ deliantra/Deliantra-Client/DC/Pod.pm 2010/04/03 02:58:25 1.24 @@ -1,7 +1,6 @@ package DC::Pod; -use strict; -use utf8; +use common::sense; use Storable; @@ -42,13 +41,12 @@ return 1 unless @path; - my $kw = lc pop @path; + my $kw = pop @path; $node = $node->[N_PARENT] or return 0; - #TODO: maybe get rid of lowercasing? - return scalar grep lc eq $kw, @{ $node->[N_KW] }; + return scalar grep $_ eq $kw, @{ $node->[N_KW] }; } sub find(@) { @@ -56,14 +54,15 @@ return unless @path; - my $kw = lc pop @path; + my $kw = pop @path; - # TODO: make sure results are unique + my %res = map +($_, $_), + grep { is_prefix_of $_, @path } + map @$_, + $kw eq "*" ? values %wiki + : $wiki{$kw} || (); - grep { is_prefix_of $_, @path } - map @$_, - $kw eq "*" ? @wiki{sort keys %wiki} - : $wiki{$kw} || () + values %res } sub full_path_of($) { @@ -71,8 +70,7 @@ my @path; - # skip toplevel hierarchy pod/, because its not a document - while ($node->[N_PARENT]) { + while ($node) { unshift @path, $node; $node = $node->[N_PARENT]; }