📄 man.pm
字号:
. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C----END OF PREAMBLE----#`# for cperl-mode}############################################################################### Module return value and documentation##############################################################################1;__END__=head1 NAMEPod::Man - Convert POD data to formatted *roff input=head1 SYNOPSIS use Pod::Man; my $parser = Pod::Man->new (release => $VERSION, section => 8); # Read POD from STDIN and write to STDOUT. $parser->parse_file (\*STDIN); # Read POD from file.pod and write to file.1. $parser->parse_from_file ('file.pod', 'file.1');=head1 DESCRIPTIONPod::Man is a module to convert documentation in the POD format (thepreferred language for documenting Perl) into *roff input using the manmacro set. The resulting *roff code is suitable for display on a terminalusing L<nroff(1)>, normally via L<man(1)>, or printing using L<troff(1)>.It is conventionally invoked using the driver script B<pod2man>, but it canalso be used directly.As a derived class from Pod::Simple, Pod::Man supports the same methods andinterfaces. See L<Pod::Simple> for all the details.new() can take options, in the form of key/value pairs that control thebehavior of the parser. See below for details.If no options are given, Pod::Man uses the name of the input file with anytrailing C<.pod>, C<.pm>, or C<.pl> stripped as the man page title, tosection 1 unless the file ended in C<.pm> in which case it defaults tosection 3, to a centered title of "User Contributed Perl Documentation", toa centered footer of the Perl version it is run with, and to a left-handfooter of the modification date of its input (or the current date if givenSTDIN for input).Pod::Man assumes that your *roff formatters have a fixed-width font namedCW. If yours is called something else (like CR), use the C<fixed> option tospecify it. This generally only matters for troff output for printing.Similarly, you can set the fonts used for bold, italic, and bold italicfixed-width output.Besides the obvious pod conversions, Pod::Man also takes care of formattingfunc(), func(3), and simple variable references like $foo or @bar so youdon't have to use code escapes for them; complex expressions likeC<$fred{'stuff'}> will still need to be escaped, though. It also translatesdashes that aren't used as hyphens into en dashes, makes long dashes--likethis--into proper em dashes, fixes "paired quotes," makes C++ look right,puts a little space between double underbars, makes ALLCAPS a teeny bitsmaller in B<troff>, and escapes stuff that *roff treats as special so thatyou don't have to.The recognized options to new() are as follows. All options take a singleargument.=over 4=item centerSets the centered page header to use instead of "User Contributed PerlDocumentation".=item dateSets the left-hand footer. By default, the modification date of the inputfile will be used, or the current date if stat() can't find that file (thecase if the input is from STDIN), and the date will be formatted asYYYY-MM-DD.=item fixedThe fixed-width font to use for vertabim text and code. Defaults to CW.Some systems may want CR instead. Only matters for B<troff> output.=item fixedboldBold version of the fixed-width font. Defaults to CB. Only matters forB<troff> output.=item fixeditalicItalic version of the fixed-width font (actually, something of a misnomer,since most fixed-width fonts only have an oblique version, not an italicversion). Defaults to CI. Only matters for B<troff> output.=item fixedbolditalicBold italic (probably actually oblique) version of the fixed-width font.Pod::Man doesn't assume you have this, and defaults to CB. Some systems(such as Solaris) have this font available as CX. Only matters for B<troff>output.=item nameSet the name of the manual page. Without this option, the manual name isset to the uppercased base name of the file being converted unless themanual section is 3, in which case the path is parsed to see if it is a Perlmodule path. If it is, a path like C<.../lib/Pod/Man.pm> is converted intoa name like C<Pod::Man>. This option, if given, overrides any automaticdetermination of the name.=item quotesSets the quote marks used to surround CE<lt>> text. If the value is asingle character, it is used as both the left and right quote; if it is twocharacters, the first character is used as the left quote and the second asthe right quoted; and if it is four characters, the first two are used asthe left quote and the second two as the right quote.This may also be set to the special value C<none>, in which case no quotemarks are added around CE<lt>> text (but the font is still changed for troffoutput).=item releaseSet the centered footer. By default, this is the version of Perl you runPod::Man under. Note that some system an macro sets assume that thecentered footer will be a modification date and will prepend something like"Last modified: "; if this is the case, you may want to set C<release> tothe last modified date and C<date> to the version number.=item sectionSet the section for the C<.TH> macro. The standard section numberingconvention is to use 1 for user commands, 2 for system calls, 3 forfunctions, 4 for devices, 5 for file formats, 6 for games, 7 formiscellaneous information, and 8 for administrator commands. There is a lotof variation here, however; some systems (like Solaris) use 4 for fileformats, 5 for miscellaneous information, and 7 for devices. Still othersuse 1m instead of 8, or some mix of both. About the only section numbersthat are reliably consistent are 1, 2, and 3.By default, section 1 will be used unless the file ends in .pm in which casesection 3 will be selected.=backThe standard Pod::Simple method parse_file() takes one argument naming thePOD file to read from. By default, the output is sent to STDOUT, but thiscan be changed with the output_fd() method.The standard Pod::Simple method parse_from_file() takes up to twoarguments, the first being the input file to read POD from and the secondbeing the file to write the formatted output to.You can also call parse_lines() to parse an array of lines orparse_string_document() to parse a document already in memory. To put theoutput into a string instead of a file handle, call the output_string()method. See L<Pod::Simple> for the specific details.=head1 DIAGNOSTICS=over 4=item roff font should be 1 or 2 chars, not "%s"(F) You specified a *roff font (using C<fixed>, C<fixedbold>, etc.) thatwasn't either one or two characters. Pod::Man doesn't support *roff fontslonger than two characters, although some *roff extensions do (the canonicalversions of B<nroff> and B<troff> don't either).=item Invalid quote specification "%s"(F) The quote specification given (the quotes option to the constructor) wasinvalid. A quote specification must be one, two, or four characters long.=back=head1 BUGSEight-bit input data isn't handled at all well at present. The correctapproach would be to map EE<lt>E<gt> escapes to the appropriate UTF-8characters and then do a translation pass on the output according to theuser-specified output character set. Unfortunately, we can't send eight-bitdata directly to the output unless the user says this is okay, since somevendor *roff implementations can't handle eight-bit data. If the *roffimplementation can, however, that's far superior to the current hackedcharacters that only work under troff.There is currently no way to turn off the guesswork that tries to formatunmarked text appropriately, and sometimes it isn't wanted (particularlywhen using POD to document something other than Perl). Most of the worktowards fixing this has now been done, however, and all that's still neededis a user interface.The NAME section should be recognized specially and index entries emittedfor everything in that section. This would have to be deferred until thenext section, since extraneous things in NAME tends to confuse various manpage processors. Currently, no index entries are emitted for anything inNAME.Pod::Man doesn't handle font names longer than two characters. Neither domost B<troff> implementations, but GNU troff does as an extension. It wouldbe nice to support as an option for those who want to use it.The preamble added to each output file is rather verbose, and most of itis only necessary in the presence of non-ASCII characters. It wouldideally be nice if all of those definitions were only output if needed,perhaps on the fly as the characters are used.Pod::Man is excessively slow.=head1 CAVEATSThe handling of hyphens and em dashes is somewhat fragile, and one may getthe wrong one under some circumstances. This should only matter forB<troff> output.When and whether to use small caps is somewhat tricky, and Pod::Man doesn'tnecessarily get it right.Converting neutral double quotes to properly matched double quotes doesn'twork unless there are no formatting codes between the quote marks. Thisonly matters for troff output.=head1 AUTHORRuss Allbery <rra@stanford.edu>, based I<very> heavily on the originalB<pod2man> by Tom Christiansen <tchrist@mox.perl.com>. The modifications towork with Pod::Simple instead of Pod::Parser were originally contributed bySean Burke (but I've since hacked them beyond recognition and all bugs aremine).=head1 COPYRIGHT AND LICENSECopyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007by Russ Allbery <rra@stanford.edu>.This program is free software; you may redistribute it and/or modify itunder the same terms as Perl itself.=head1 SEE ALSOL<Pod::Simple>, L<perlpod(1)>, L<pod2man(1)>, L<nroff(1)>, L<troff(1)>,L<man(1)>, L<man(7)>Ossanna, Joseph F., and Brian W. Kernighan. "Troff User's Manual,"Computing Science Technical Report No. 54, AT&T Bell Laboratories. This isthe best documentation of standard B<nroff> and B<troff>. At the time ofthis writing, it's available atL<http://www.cs.bell-labs.com/cm/cs/cstr.html>.The man page documenting the man macro set may be L<man(5)> instead ofL<man(7)> on your system. Also, please see L<pod2man(1)> for extensivedocumentation on writing manual pages if you've not done it before andaren't familiar with the conventions.The current version of this module is always available from its web site atL<http://www.eyrie.org/~eagle/software/podlators/>. It is also part of thePerl core distribution as of 5.6.0.=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -