Subject: | [feature request] -perldocopt for supplying perldoc options |
So user may become able to do like
-perldocopt => "-M Pod::Perldoc::ToMan"
Below patch is based on version 1.67 of Pod/Usage.pm
--- lib/Pod/Usage.pm.1.67 2015-12-19 10:54:15.746666667 +0800
+++ lib/Pod/Usage.pm 2015-12-19 12:45:50.996666668 +0800
@@ -128,7 +128,7 @@
}
## Check for perldoc
- my $progpath = $opts{perldoc} ? $opts{perldoc} :
+ my $progpath = $opts{'-perldoc'} ? $opts{'-perldoc'} :
File::Spec->catfile($Config{scriptdirexp}
|| $Config{scriptdir}, 'perldoc');
@@ -149,7 +149,13 @@
if(defined $opts{-input} && $opts{-input} =~ /^\s*(\S.*?)\s*$/) {
# the perldocs back to 5.005 should all have -F
# without -F there are warnings in -T scripts
- my @perldoc_cmd = ( $progpath, '-F', $1 );
+ my @perldoc_cmd = ($progpath);
+ if ($opts{'-perldocopt'}) {
+ $opts{'-perldocopt'} =~ s/^\s+//;
+ $opts{'-perldocopt'} =~ s/\s+$//;
+ push @perldoc_cmd, split(/\s+/, $opts{'-perldocopt'});
+ }
+ push @perldoc_cmd, ('-F', $1 );
unshift @perldoc_cmd, $opts{'-perlcmd'} if $opts{'-perlcmd'};
system(@perldoc_cmd);
if($?) {
@@ -398,7 +404,8 @@
pod2usage( -verbose => 2,
-perlcmd => $path_to_perl,
- -perldoc => $path_to_perldoc );
+ -perldoc => $path_to_perldoc,
+ -perldocopt => $perldoc_options );
=head1 ARGUMENTS
@@ -540,6 +547,11 @@
thinks it is (see L<Config>), the -perldoc option may be used to supply
the correct path to L<perldoc>.
+=item C<-perldocopt>
+
+By default, Pod::Usage will call L<perldoc> when -verbose >= 2 is
+specified. The -perldocopt option may be used to supply options to L<perldoc>.
+
=back
=head2 Formatting base class