#!/home/centos/perldoc-browser/perls/5.30.2/bin/perl eval 'exec /home/centos/perldoc-browser/perls/5.30.2/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # Convert POD data to formatted *roff input. # # The driver script for Pod::Man. # # SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl use 5.006; use strict; use warnings; use Getopt::Long qw(GetOptions); use Pod::Man (); use Pod::Usage qw(pod2usage); use strict; # Clean up $0 for error reporting. $0 =~ s%.*/%%; # Insert -- into @ARGV before any single dash argument to hide it from # Getopt::Long; we want to interpret it as meaning stdin. my $stdin; @ARGV = map { $_ eq '-' && !$stdin++ ? ('--', $_) : $_ } @ARGV; # Parse our options, trying to retain backward compatibility with pod2man but # allowing short forms as well. --lax is currently ignored. my %options; Getopt::Long::config ('bundling_override'); GetOptions (\%options, 'center|c=s', 'date|d=s', 'errors=s', 'fixed=s', 'fixedbold=s', 'fixeditalic=s', 'fixedbolditalic=s', 'help|h', 'lax|l', 'lquote=s', 'name|n=s', 'nourls', 'official|o', 'quotes|q=s', 'release|r=s', 'rquote=s', 'section|s=s', 'stderr', 'verbose|v', 'utf8|u') or exit 1; pod2usage (0) if $options{help}; # Official sets --center, but don't override things explicitly set. if ($options{official} && !defined $options{center}) { $options{center} = 'Perl Programmers Reference Guide'; } # Verbose is only our flag, not a Pod::Man flag. my $verbose = $options{verbose}; delete $options{verbose}; # This isn't a valid Pod::Man option and is only accepted for backward # compatibility. delete $options{lax}; # If neither stderr nor errors is set, default to errors = die. if (!defined $options{stderr} && !defined $options{errors}) { $options{errors} = 'die'; } # Initialize and run the formatter, pulling a pair of input and output off at # a time. For each file, we check whether the document was completely empty # and, if so, will remove the created file and exit with a non-zero exit # status. my $parser = Pod::Man->new (%options); my $status = 0; my @files; do { @files = splice (@ARGV, 0, 2); print " $files[1]\n" if $verbose; $parser->parse_from_file (@files); if ($parser->{CONTENTLESS}) { $status = 1; if (defined $files[0]) { warn "$0: unable to format $files[0]\n"; } else { warn "$0: unable to format standard input\n"; } if (defined ($files[1]) and $files[1] ne '-') { unlink $files[1] unless (-s $files[1]); } } } while (@ARGV); exit $status; __END__ =for stopwords en em --stderr stderr --utf8 UTF-8 overdo markup MT-LEVEL Allbery Solaris URL troff troff-specific formatters uppercased Christiansen --nourls UTC prepend lquote rquote =head1 NAME pod2man - Convert POD data to formatted *roff input =head1 SYNOPSIS pod2man [B<--center>=I] [B<--date>=I] [B<--errors>=I