Skip Menu |
 

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 51560
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: joenio [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-Property-to-pass-args-to-Pod-Man-when-manify-Pods.patch



Subject: Support UTF8 when manify Pod
Follow a PATCH to add new property called extra_manify_args to pass args to Pod::Man module.
Subject: 0001-Property-to-pass-args-to-Pod-Man-when-manify-Pods.patch
From 37ef13bdcbcdba429e6eb45b35b455cdb200245f Mon Sep 17 00:00:00 2001 From: Joenio Costa <joenio@perl.org.br> Date: Sun, 15 Nov 2009 20:26:41 -0300 Subject: [PATCH] Property to pass args to Pod::Man when manify Pods --- lib/Module/Build/Base.pm | 13 ++++++--- t/manifypods_with_utf8.t | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 t/manifypods_with_utf8.t diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm index 240936c..d79a9e9 100644 --- a/lib/Module/Build/Base.pm +++ b/lib/Module/Build/Base.pm @@ -967,6 +967,7 @@ __PACKAGE__->add_property($_) for qw( verbose debug xs_files + extra_manify_args ); sub config { @@ -2971,10 +2972,12 @@ sub ACTION_manpages { my $sub = $self->can("manify_${type}_pods"); next unless defined( $sub ); + my %extra_manify_args = $self->{properties}{'extra_manify_args'} ? %{ $self->{properties}{'extra_manify_args'} } : (); + if ( $self->invoked_action eq 'manpages' ) { - $self->$sub(); + $self->$sub( %extra_manify_args ); } elsif ( $self->_is_default_installable("${type}doc") ) { - $self->$sub(); + $self->$sub( %extra_manify_args ); } } @@ -2982,6 +2985,7 @@ sub ACTION_manpages { sub manify_bin_pods { my $self = shift; + my %podman_args = (section => 1, @_); # binaries go in section 1 my $files = $self->_find_pods( $self->{properties}{bindoc_dirs}, exclude => [ file_qr('\.bat$') ] ); @@ -2994,7 +2998,7 @@ sub manify_bin_pods { foreach my $file (keys %$files) { # Pod::Simple based parsers only support one document per instance. # This is expected to change in a future version (Pod::Simple > 3.03). - my $parser = Pod::Man->new( section => 1 ); # binaries go in section 1 + my $parser = Pod::Man->new( %podman_args ); my $manpage = $self->man1page_name( $file ) . '.' . $self->config( 'man1ext' ); my $outfile = File::Spec->catfile($mandir, $manpage); @@ -3008,6 +3012,7 @@ sub manify_bin_pods { sub manify_lib_pods { my $self = shift; + my %podman_args = (section => 3, @_); # libraries go in section 3 my $files = $self->_find_pods($self->{properties}{libdoc_dirs}); return unless keys %$files; @@ -3019,7 +3024,7 @@ sub manify_lib_pods { while (my ($file, $relfile) = each %$files) { # Pod::Simple based parsers only support one document per instance. # This is expected to change in a future version (Pod::Simple > 3.03). - my $parser = Pod::Man->new( section => 3 ); # libraries go in section 3 + my $parser = Pod::Man->new( %podman_args ); my $manpage = $self->man3page_name( $relfile ) . '.' . $self->config( 'man3ext' ); my $outfile = File::Spec->catfile( $mandir, $manpage); diff --git a/t/manifypods_with_utf8.t b/t/manifypods_with_utf8.t new file mode 100644 index 0000000..d777d1b --- /dev/null +++ b/t/manifypods_with_utf8.t @@ -0,0 +1,67 @@ +package ManifypodsWithUtf8; +use strict; +use base qw(Test::Class); +use Test::More; + +use lib 't/lib'; +blib_load('Module::Build'); +blib_load('Module::Build::ConfigData'); + +SKIP: { + unless ( Module::Build::ConfigData->feature('manpage_support') ) { + skip 'manpage_support feature is not enabled'; + } +} + +use MBTest; +use File::Spec::Functions qw( catdir ); + +sub setup_module_build : Test(startup) { + use Cwd (); + my $cwd = Cwd::cwd; + my $tmp = MBTest->tmpdir; + + use DistGen; + my $dist = DistGen->new( dir => $tmp ); + $dist->add_file( 'lib/Simple/PodWithUtf8.pod', <<'---' ); +=head1 NAME + +Simple::PodWithUtf8 - POD with some (ç á à ô) special chars + +=cut +--- + $dist->regen; + $dist->chdir_in; + + my $destdir = catdir($cwd, 't', 'install_test' . $$); + + my $mb = Module::Build->new( + module_name => $dist->name, + install_base => $destdir, + + # need default install paths to ensure manpages & HTML get generated + installdirs => 'site', + extra_manify_args => { utf8 => 1 }, + ); + $mb->add_to_cleanup($destdir); + + shift->{mb} = $mb; +} + +sub keep_special_chars_after_manify : Tests { + my $mb = shift->{mb}; + $mb->dispatch('build'); + my $sep = $mb->manpage_separator; + my $ext3 = $mb->config('man3ext'); + my $to = File::Spec->catfile('blib', 'libdoc', "Simple${sep}PodWithUtf8.${ext3}"); + + open POD, '<:utf8', $to; + undef $/; my $pod_content = <POD>; + close POD; + + ok $pod_content =~ qr/ \(ç á à ô\) /, "POD should contain special characters"; +}; + +__PACKAGE__->runtests; + +1; -- 1.6.5.2
Download (untitled) / with headers
text/plain 172b
Thank you very much. I'm not sure when we'll get around to applying it - we're in feature/new-bug freeze in preparation for 0.36, but it'll get applied for 0.37. -- David
Download (untitled) / with headers
text/plain 216b
On Sun Nov 15 18:32:16 2009, joenio wrote: Show quoted text
> Follow a PATCH to add new property called extra_manify_args to pass args > to Pod::Man module.
I've finally come back & applied this patch. Thanks for sending it. -Ken


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.