The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pod::Index::Builder - Build a pod index

SYNOPSYS

use Pod::Index::Builder;

my $p = Pod::Index::Builder->new;
for my $file (@ARGV) {
    $p->parse_from_file($file);
}

$p->print_index;

DESCRIPTION

This is a subclass of Pod::Parser that reads POD and outputs nothing. However, it saves the position of every X<> entry it sees. The index can be retrieved as a hashref, or printed to the output filehandle in a format that is understandable by Pod::Index::Search.

METHODS

pod_index

Retrieves the index as a hashref. The hash keys are the keywords contained in the X<> tags; the values are array references of "positions", in the format "filename:line_number". A sample use, taken from the print_index method, is as follows:

my $idx = $p->pod_index;

for my $key (sort keys %$idx) {
    for my $pos (@{$idx->{$key}}) {
        print $fh "$key\t$pos\n";
    }
}
$parser->print_index($fh);
$parser->print_index($filename);
$parser->print_index();

Prints the index to the given ouput filename or filehandle (or STDOUT by default). The format is tab-delimited, with the key name in the first column, and the position (filename:linenumber) in the second column.

SEE ALSO

Pod::Index, Pod::Index::Search, Pod::Parser, perlpod

AUTHOR

Ivan Tubert-Brohman <itub@cpan.org>

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.