Pod::ParseLink(3pPerl Programmers Reference GuiPod::ParseLink(3p)
Pod::ParseLink - Parse an L<> formatting code in POD text
use Pod::ParseLink;
my ($text, $inferred, $name, $section, $type) = parselink ($link);
This module only provides a single function, parselink(),
which takes the text of an L<> formatting code and parses
it. It returns the anchor text for the link (if any was
given), the anchor text possibly inferred from the name and
section, the name or URL, the section if any, and the type
of link. The type will be one of 'url', 'pod', or 'man',
indicating a URL, a link to a POD page, or a link to a Unix
manual page.
Parsing is implemented per perlpodspec. For backward compa-
tibility, links where there is no section and name contains
spaces, or links where the entirety of the link (except for
the anchor text if given) is enclosed in double-quotes are
interpreted as links to a section (L</section>).
The inferred anchor text is implemented per perlpodspec:
L<name> => L<name|name>
L</section> => L<"section"|/section>
L<name/section> => L<"section" in name|name/section>
The name may contain embedded E<> and Z<> formatting codes,
and the section, anchor text, and inferred anchor text may
contain any formatting codes. Any double quotes around the
section are removed as part of the parsing, as is any lead-
ing or trailing whitespace.
If the text of the L<> escape is entirely enclosed in double
quotes, it's interpreted as a link to a section for back-
wards compatibility.
No attempt is made to resolve formatting codes. This must
be done after calling parselink (since E<> formatting codes
can be used to escape characters that would otherwise be
significant to the parser and resolving them before parsing
would result in an incorrect parse of a formatting code
like:
L<verticalE<verbar>barE<sol>slash>
which should be interpreted as a link to the
"vertical|bar/slash" POD page and not as a link to the
"slash" section of the "bar" POD page with an anchor text of
"vertical". Note that not only the anchor text will need to
perl v5.8.8 2005-02-05 1
Pod::ParseLink(3pPerl Programmers Reference GuiPod::ParseLink(3p)
have formatting codes expanded, but so will the target of
the link (to deal with E<> and Z<> formatting codes), and
special handling of the section may be necessary depending
on whether the translator wants to consider markup in sec-
tions to be significant when resolving links. See perl-
podspec for more information.
Pod::Parser
The current version of this module is always available from
its web site at
<http://www.eyrie.org/~eagle/software/podlators/>.
Russ Allbery <rra@stanford.edu>.
Copyright 2001 by Russ Allbery <rra@stanford.edu>.
This program is free software; you may redistribute it
and/or modify it under the same terms as Perl itself.
perl v5.8.8 2005-02-05 2
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.