Pod::ParseLink(3pm)
πΈ NAME πΈ
okay so bestie, welcome to the Pod::ParseLink(3pm) page from the Perl Programmers Reference Guide β¨ β and this module is here for one very specific job: parsing an L<> formatting code in POD text. thatβs the name, thatβs the vibe, no cap. π
β¨ SYNOPSIS β¨
hereβs the whole group-chat entry point, literally:
use Pod::ParseLink;
my $link = get_link();
my ($text, $inferred, $name, $section, $type) = parselink($link);
slay. thatβs it. π«Ά
π DESCRIPTION π
okay so this module is not a whole toolbox, bestie: it only provides a single function, parselink(), and its whole job is taking the text of an L<> formatting code and parsing it. periodt.
hereβs what comes back from parselink():
- 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
- 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. iconic little enum moment. π
parsing is implemented per perlpodspec. for backward compatibility, there are two legacy little situations that get interpreted as links to a section (L</section>):
- links where there is no section and the name contains spaces
- links where the entirety of the link (except for the anchor text if given) is enclosed in double-quotes
the inferred anchor text is implemented per perlpodspec too, and hereβs the exact mapping:
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 leading or trailing whitespace. cleanup era. π§
if the text of the L<> escape is entirely enclosed in double quotes, itβs interpreted as a link to a section for backward compatibility. yes, another legacy vibe. we respect the lore. π
β οΈ big important caveat: no attempt is made to resolve formatting codes. this must be done after calling parselink().
why? because 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". the parser is doing math, not vibes. π
and note: itβs not only the anchor text that will need to have formatting codes expanded β the target of the link will need it too (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 sections to be significant when resolving links. check perlpodspec for more information, bestie. π¦
π«Ά AUTHOR π«Ά
this absolute icon is Russ Allbery <rra@cpan.org>. π
π COPYRIGHT AND LICENSE π
Copyright 2001, 2008, 2009, 2014, 2018-2019, 2022, 2024 Russ Allbery <rra@cpan.org>
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
legal tea, served fresh. ββ¨
π¦ SEE ALSO π¦
Pod::Parser
the current version of this module is always available from its web site at <https://www.eyrie.org/~eagle/software/podlators/>. go click, bestie. π
okay bye bestie π β this page is Pod::ParseLink(3pm) from perl v5.42.3, dated 2026-11-03. mwah! πΈ
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms