2007-02-23 13:37:00 +01:00
|
|
|
The map() function used in the hyperestraier search plug-in doesn't work as intended as ilustrated by this simple script:
|
|
|
|
|
2007-02-23 13:40:31 +01:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
my @foo = (
|
|
|
|
[ qw/foo bar baz/ ],
|
|
|
|
[ qw/fee faa fum/ ],
|
|
|
|
);
|
|
|
|
|
|
|
|
# similar to current ikiwiki code (defective):
|
|
|
|
my @bar = map { "/path/to/$_" foreach @{$_} } @foo;
|
|
|
|
|
|
|
|
# this works:
|
|
|
|
#my @bar = map { map { "/path/to/$_" } @{$_} } @foo;
|
|
|
|
|
|
|
|
foreach (@bar) {
|
|
|
|
print "$_\n";
|
|
|
|
}
|
2007-02-23 13:37:00 +01:00
|
|
|
|
|
|
|
Expected output:
|
2007-02-23 13:40:31 +01:00
|
|
|
|
|
|
|
/path/to/foo
|
|
|
|
/path/to/bar
|
|
|
|
/path/to/baz
|
|
|
|
/path/to/fee
|
|
|
|
/path/to/faa
|
|
|
|
/path/to/fum
|
2007-02-23 13:37:00 +01:00
|
|
|
|
|
|
|
Current output:
|
2007-02-23 13:40:31 +01:00
|
|
|
|
|
|
|
Useless use of string in void context at perl-map.pl line 10.
|
2007-02-23 13:37:00 +01:00
|
|
|
|
|
|
|
The patch below fixes this issue:
|
|
|
|
|
2007-02-23 13:40:31 +01:00
|
|
|
--- IkiWiki/Plugin/search.pm.orig Thu Feb 1 23:52:03 2007
|
|
|
|
+++ IkiWiki/Plugin/search.pm Thu Feb 1 23:52:41 2007
|
|
|
|
@@ -64,8 +64,9 @@
|
|
|
|
debug(gettext("updating hyperestraier search index"));
|
|
|
|
estcmd("gather -cm -bc -cl -sd",
|
|
|
|
map {
|
|
|
|
- Encode::encode_utf8($config{destdir}."/".$_)
|
|
|
|
- foreach @{$renderedfiles{pagename($_)}};
|
|
|
|
+ map {
|
|
|
|
+ Encode::encode_utf8($config{destdir}."/".$_)
|
|
|
|
+ } @{$renderedfiles{pagename($_)}};
|
|
|
|
} @_
|
|
|
|
);
|
2007-02-23 20:36:31 +01:00
|
|
|
estcfg();
|
|
|
|
|
|
|
|
[[bugs/done]] ; thanks for the patch. Suprised it worked at all since the
|
|
|
|
bad code was added (did it?) --[[Joey]]
|
2007-03-04 23:55:12 +01:00
|
|
|
|
|
|
|
Thank you for accepting my patch. I can't see how it could ever have worked with the previous code, no. --[[Brix]]
|