develooper Front page | perl.perl5.porters | Postings from July 2005

[RFC] Pod/Perldoc.pm patch, for POD2::IT and other podstranslations

From:
Enrico Sorcinelli
Date:
July 27, 2005 07:55
Subject:
[RFC] Pod/Perldoc.pm patch, for POD2::IT and other podstranslations
Message ID:
20050727165737.41f4a823.bepi@perl.it
Hi all,

after almost two years from RFC, italian Perl users published (finally!) to
CPAN a large part of translated core Perl pods (including perlfunc and perlfaq*)
into the package POD2::IT where 'IT' is the language code. This has been (and
currently still is) a very big work! :-) 
(See http://pod2it.sf.net for more details about the project)

Once the package has been installed, the translated documentation can be
accessed with: 

	%> perldoc POD2::IT::<podname>

However the -f and -q switches don't work no longer. 

So, I made a simple patch to Pod/Perldoc.pm 3.14 (available at
http://www.perl.it/blog/archives/Perldoc.pm-3.14-patch ) in order to allow also
the syntax: 

	%> perldoc -L IT <podname>
	%> perldoc -L IT -f <function>
	%> perldoc -L IT -q <FAQregex>

The patch adds the -L switch that allows to define language code for desired
language translation. If POD2::<code> package doesn't exists, the effect of the
switch will be ignored. 

Since Pod/Perldoc.pm's search_perlfunc uses hard coded string 'Alphabetical
Listing of Perl Functions' to skip introduction, in order to make it to work
with other languages with the option -L, I used a simple plugin-like mechanism. 

POD2::<code> language package must export search_perlfunc_re that returns a
localized translation of the paragraph string above. This string will be used to
skip perlfunc.pod intro. Again, if POD2::<code>->search_perlfunc_re fails (or
doesn't exist), we'll come back to the default behavoiur. This mechanism allows
to add additional POD2::* translations without need to patch Pod/Perldoc.pm
every time. 

What do you think? 

Regards 


	- Enrico

PS: I'm not shure if this is the right place to post these things (I've also
posted to perl-documentation list a few days ago without any reply), so sorry
for that :-)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About