#!/home/perldoc/perldoc-browser/perls/5.20.0/bin/perl eval 'exec /home/perldoc/perldoc-browser/perls/5.20.0/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell eval 'exec /home/perldoc/perldoc-browser/perls/5.20.0/bin/perl -S $0 ${1+"$@"}' if $running_under_some_shell; # pod2man -- Convert POD data to formatted *roff input. # # Copyright 1999, 2000, 2001, 2004, 2006, 2008, 2010, 2012, 2013 # Russ Allbery # # This program is free software; you may redistribute it and/or modify it # under the same terms as Perl itself. require 5.004; 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', 'name|n=s', 'nourls', 'official|o', 'quotes|q=s', 'release|r: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; warn "$0: unable to format $files[0]\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 =head1 NAME pod2man - Convert POD data to formatted *roff input =head1 SYNOPSIS pod2man [B<--center>=I] [B<--date>=I] [B<--errors>=I