Subject: | "perldoc -f" show nothing if not perlfunc.pod file translated exists |
Normally, perldoc search the function indicated with '-f':
---------------------------------------------------------------------------------
$ perldoc -f abs
abs VALUE
abs Returns the absolute value of its argument. If VALUE is omitted,
uses $_.
---------------------------------------------------------------------------------
perldoc with a POD2::xx distribution installed, perldoc search for perlfunc.pod file translated:
---------------------------------------------------------------------------------
$ perldoc -V
Perldoc v3.25, under perl v5.022000 for linux
$ echo $PERLDOC_POD2
es
$ perldoc -f abs
abs VALOR
abs Devuelve el valor absoluto del argumento. Si se omite VALOR, se
usa $_.
---------------------------------------------------------------------------------
BUT... if perlfunc.pod is NOT translated, perldoc should to read original perlfunc.pod file, but perlfunc is special with "perldoc -f".
Perldoc.pm:
---------------------------------------------------------------------------------
1307 my $re = 'Alphabetical Listing of Perl Functions';
1308
1309 # Check available translator or backup to default (english)
1310 if ( $self->opt_L && defined $self->{'translators'}->[0] ) {
1311 my $tr = $self->{'translators'}->[0];
1312 $re = $tr->search_perlfunc_re if $tr->can('search_perlfunc_re');
1313 if ( $] < 5.008 ) {
1314 $self->aside("Your old perl doesn't really have proper unicode support.");
1315 }
1316 }
1317
1318 # Skip introduction
1319 local $_;
1320 while (<$fh>) {
1321 /^=encoding\s+(\S+)/ && $self->set_encoding($fh, $1);
1322 last if /^=head2 $re/;
1323 }
1324
---------------------------------------------------------------------------------
Perldoc.pm tried to change $re to translated version.
$re = $tr->search_perlfunc_re can return a valid string, but perlfunc.pod can be not installed into POD2::xx distribution (Example: POD2-ES-5.16.2.02)
So, the while loop at 1320 fail to find, because $fh is the filehandle of original (english) perlfunc.pod:
---------------------------------------------------------------------------------
$ perldoc -f abs
No documentation for perl function 'abs' found
---------------------------------------------------------------------------------
Workaround (increase sturdiness):
---------------------------------------------------------------------------------
1322c1322
< last if /^=head2 $re/;
---
Show quoted text
> last if /^=head2 (?:$re|Alphabetical Listing of Perl Functions)/;
---------------------------------------------------------------------------------