.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pod::Index 3pm" .TH Pod::Index 3pm "2016-09-18" "perl v5.22.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::Index \- Index and search PODs using X<> entries. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& ### to create an index: \& use Pod::Index::Builder; \& \& my $p = Pod::Index::Builder\->new; \& for my $file (@ARGV) { \& $p\->parse_from_file($file); \& } \& \& $p\->print_index("index.txt"); \& \& \& ### to search for a keyword in the index: \& use Pod::Index::Search; \& \& my $q = Pod::Index::Search\->new( \& filename => \*(Aqindex.txt\*(Aq, \& ); \& \& my @results = $q\->search(\*(Aqgetprotobyname\*(Aq); \& \& for my $r (@results) { \& printf "%s\et%s\en", $r\->podname, $r\->line; \& print $r\->pod; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The Pod-Index distribution includes various modules for indexing and searching \s-1POD\s0 that is appropriately marked with X<> \s-1POD\s0 codes. .PP \&\f(CW\*(C`Pod::Index\*(C'\fR, as a module, does nothing. Everything is done by Pod::Index::Builder, Pod::Index::Search, and other helper modules. .PP This document discusses some of the general issues with \s-1POD\s0 indexing; specifically, the recommended conventions for the use of X<> codes. .SH "BACKGROUND" .IX Header "BACKGROUND" The little-known (or at least little-used) X<> formatting code is described in perlpod: .PP .Vb 4 \& "X" \-\- an index entry \& This is ignored by most formatters, but some may use it for build\- \& ing indexes. It always renders as empty\-string. Example: "X" .Ve .SH "CONVENTIONS FOR THE USE OF X<> CODES" .IX Header "CONVENTIONS FOR THE USE OF X<> CODES" .SS "Placement of the X<> entries" .IX Subsection "Placement of the X<> entries" First, a definition. By \*(L"scope\*(R", I mean the part of the document that is deemed relevant to an index entry, and that may be extracted and shown in isolation by a processing or display tool. For example, perldoc \-f considers the scope of a function to end at the beginning of the next =item, or at the end of the enclosing =over. .PP The X<> entries should be added at the end of a command or textblock paragraph (verbatim paragraphs are excluded). The scope of the index entry starts at the beginning of the paragraph to which it was attached; the end of the scope depends on the command type: .PP 1) if the X<> is at the end of a textblock, the scope is that paragraph and zero or more verbatim paragraphs immediately following it. .PP 2) if the X<> is at the end of a command paragraph, it depends on the type of command: .IP "=head1, head2, etc." 4 .IX Item "=head1, head2, etc." The scope ends right before the next heading with equal or higher level. That is, a =head1 ends at the next =head1, and a =head2 ends at the next =head2 or =head1. .IP "=item" 4 .IX Item "=item" The scope ends right before the next =item, or the =back that terminates the containing list. Note: \*(L"empty\*(R" items are not counted for terminating scopes, to allow for cases where multiple =items head a block of text. For example, .Sp .Vb 3 \& =item function \& X \& X \& \& =item otherfunction \& \& C and C do the same thing, \& even if they have different names... \& \& =item lemonade .Ve .Sp Here the scope of the X and X entries starts with \*(L"=item function\*(R", and ends right before \*(L"=item lemonade\*(R". .PP 3) other command paragraphs, such as =back, =over, =begin, =end, and =for should not be used for attaching X<> entries. .SS "Content of the X<> entry." .IX Subsection "Content of the X<> entry." .IP "\(bu" 4 It should contain plain text without further formatting codes (with the possible exception of E<>). .IP "\(bu" 4 It should be in lowercase, unless caps are required due to case-sensitivity or correctness. .IP "\(bu" 4 Non-word characters are allowed, so one can list things like operators and special variables. .IP "\(bu" 4 Use of synonyms is encouraged, to make things easier to find. .IP "\(bu" 4 To be consistent, words should be normalized to the singular whenever possible. For example, use X instead of X. .IP "\(bu" 4 The use of a comma in an index entry has a special meaning: it separates levels of hierarchy (or namespaces), as a way of classifying entries in more specific ways. For example, \*(L"X\*(R", or \&\*(L"X\*(R". This information may be used by processing programs to arrange the entries, or for listing results when a user searches for a namespace that contains several entries. .IP "\(bu" 4 There's no limitation as to the number of times that a given entry can appear in a document or collection of documents. That is, it is not an error to have X appear twice in the same file. .SH "VERSION" .IX Header "VERSION" 0.14 .SH "SEE ALSO" .IX Header "SEE ALSO" Pod::Index::Builder, Pod::Index::Search, Pod::Index::Entry, perlpod .SH "AUTHOR" .IX Header "AUTHOR" Ivan Tubert-Brohman .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2005 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.