[PATCH] Pod::Perldoc patches and new (little) feature
[email protected] (Enrico Sorcinelli)
| Newsgroups | perl.pod-people |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I have patched Pod::Perldoc (3.15, latest CPAN and blead version) by
adding some features and fixed several bugs regarding POD2 translation
packages integration.
In particular:
* "PERLDOC_POD2" environment variable could be used, to set once, the
preferred translation (instead of using "-L" switch each time). For
example with:
export PERLDOC_POD2=it
perldoc will use POD2::IT translations (if there are, english to default).
If "PERLDOC_POD2=1", the language code will be auto-retrieved from
locale, that is, from "LC_ALL" "LC_LANG" "LANG" environment variables
respectively (I don't know if is the right order).
For example with:
export PERLDOC_POD2=1
perldoc will use POD2::FR translations (if there are, english to
default) assuming "LC_ALL=fr_FR" on your machine.
(Note that "-L" switch overrides "PERLDOC_POD2" settings).
* bug fix: -f switch works correctly with missing translations. For
example 'perldoc -L pt -f ' retrieves the standard (English) version
if it cannot find the Portuguese translation.
* bug fix: perldoc now correctly works with several translators (f.e.
perldoc -L "it fr").
Best
- Enrico
PS1: I omitted patches for doc and changes files
PS2: also Pod::Perldoc since v 3.14_02 breaks POD2:: packages
1) we cannot wait for 5.10.2 :-)
2) we cannot wait for POD2::Base into the core Perl distribution (even
if could be the better thing)
3) I cannot/don't want force to install also POD2::Base
the only way to solve now the problem is to update POD2::IT package
(IT.pm file) in order to work again with Perl 5.10.1 by adding those
methods:
sub new {
return __PACKAGE__;
}
sub pod_dirs {
( my $mod = __PACKAGE__ . '.pm' ) =~ s|::|/|g;
( my $dir = $INC{$mod} ) =~ s/\.pm\z//;
return $dir;
}
Pod_Perldoc_3.15.patch
(application/octet-stream, 1.4 KB)
--- /home/bepi/tmp/Pod-Perldoc-3.15/lib/Pod/Perldoc.pm 2008-11-01 14:45:35.000000000 +0100
+++ lib/Pod/Perldoc.pm 2009-09-09 19:52:57.000000000 +0200
@@ -12,7 +12,7 @@
use vars qw($VERSION @Pagers $Bindir $Pod2man
$Temp_Files_Created $Temp_File_Lifetime
);
-$VERSION = '3.15';
+$VERSION = '3.15_01';
#..........................................................................
BEGIN { # Make a DEBUG constant very first thing...
@@ -658,8 +658,11 @@
$self->opt_n("nroff") unless $self->opt_n;
$self->add_formatter_option( '__nroffer' => $self->opt_n );
+ # Get language from PERLDOC_POD2 environment variable
+ $self->opt_L || ( $ENV{PERLDOC_POD2} eq '1' ? $self->_elem('opt_L',(split(/\_/, $ENV{LC_ALL} || $ENV{LC_LANG} || $ENV{LANG}))[0] ) : $self->_elem('opt_L', $ENV{PERLDOC_POD2}) );
+
# Adjust for using translation packages
- $self->add_translator($self->opt_L) if $self->opt_L;
+ $self->add_translator(split(/\s+/,$self->opt_L)) if $self->opt_L;
return;
}
@@ -965,7 +968,9 @@
print "Going to perlfunc-scan for $search_re in $perlfunc\n";
my $re = 'Alphabetical Listing of Perl Functions';
- if ( $self->opt_L ) {
+
+ # Check available translator or backup to default (english)
+ if ( $self->opt_L && defined $self->{'translators'}->[0] ) {
my $tr = $self->{'translators'}->[0];
$re = $tr->search_perlfunc_re if $tr->can('search_perlfunc_re');
}