diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-12-21 10:56:26 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-12-21 10:56:26 +0100 |
commit | 45a365ecad09daa21b857729acdb84399a1ea2b6 (patch) | |
tree | e9c4f0399aebc3821e9801a1612672d5512a683b /installman | |
parent | ace6885803467dcfa5af494c1215d0faa0042f88 (diff) | |
download | perl-45a365ecad09daa21b857729acdb84399a1ea2b6.tar.gz |
In installman, move the call to File::Find::find() to the top level.
The code to recursively scan a directory with File::File::find() is now only
used by one caller of podset(), so move it to the call point, reducing the
amount of conditional code within podset(). The first argument to podset()
is now always a reference to a hash of "work to be done". Add an optional
fourth argument to give the directory name for diagnostics.
Diffstat (limited to 'installman')
-rwxr-xr-x | installman | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/installman b/installman index fb43e85bb4..29d73dc23f 100755 --- a/installman +++ b/installman @@ -64,22 +64,38 @@ $opts{verbose} ||= $opts{V} || $opts{notify}; $packlist = ExtUtils::Packlist->new("$opts{destdir}$Config{installarchlib}/.packlist"); -# manpages not to be installed -my %do_not_install = map { ($_ => 1) } qw( - Pod/Functions.pm - XS/APItest.pm - XS/Typemap.pm -); - # Install the main pod pages. pod2man({ map { ($_->[0], $_->[1]) } @{$state->{master}} - }, $opts{man1dir}, $opts{man1ext}); + }, $opts{man1dir}, $opts{man1ext}, 'pod'); # Install the pods for library modules. -pod2man('lib', $opts{man3dir}, $opts{man3ext}); +{ + # manpages not to be installed + my %do_not_install = map { ($_ => 1) } + qw(Pod/Functions.pm XS/APItest.pm XS/Typemap.pm); + + my %modpods; + File::Find::find({no_chdir=>1, + wanted => sub { + # $_ is $File::Find::name when using no_chdir + if (-f $_ and /\.p(?:m|od)$/) { + my $pod = $_; + # Skip .pm files that have corresponding .pod files + return if $pod =~ s/\.pm$/.pod/ && -f $pod; + return if m!(?:^|/)t/!; + s!^lib/!!; + return if $do_not_install{$_}; + return if is_duplicate_pod($File::Find::name); + $modpods{$_} = $File::Find::name; + } + }}, + 'lib'); + + pod2man(\%modpods, $opts{man3dir}, $opts{man3ext}, 'lib'); +} # Install the pods embedded in the installed scripts my $has_man1dir = $opts{man1dir} ne '' && -d $opts{man1dir}; @@ -106,51 +122,28 @@ while (<UTILS>) { } sub pod2man { - my($what, $mandir, $manext) = @_; + my($modpods, $mandir, $manext, $where) = @_; if ($mandir eq ' ' or $mandir eq '') { - if (ref $what) { + if ($where) { + warn "Skipping installation of $where man pages.\n" + } else { warn "Skipping installation of $_ man page.\n" - foreach values %$what; - } else { - warn "Skipping installation of $what man pages.\n" - } - return; + foreach values %$modpods; + } + return; } if ($opts{verbose}) { - if (ref $what) { - print "installing $_\n" - foreach sort keys %$what; + if ($where) { + print "installing from $where\n"; } else { - print "installing from $what\n"; + print "installing $_\n" + foreach sort keys %$modpods; } } mkpath($mandir, $opts{verbose}, 0777) unless $opts{notify}; # In File::Path - my $modpods; - if (ref $what) { - $modpods = $what; - } - else { - # Make a list of all the .pm and .pod files in the directory. - File::Find::find({no_chdir=>1, - wanted => sub { - # $_ is $File::Find::name when using no_chdir - if (-f $_ and /\.p(?:m|od)$/) { - my $pod = $_; - # Skip .pm files that have corresponding .pod files - return if $pod =~ s/\.pm$/.pod/ && -f $pod; - return if m!(?:^|/)t/!; - s!^\Q$what\E/!!; - return if $do_not_install{$_}; - return if is_duplicate_pod($File::Find::name); - $modpods->{$_} = $File::Find::name; - } - }}, - $what); - } - foreach my $manpage (sort keys %$modpods) { my $mod = $modpods->{$manpage}; |