Pod::ParseLink(3perl)

okay bestie so this is Pod::ParseLink, part of the Perl Programmers Reference Guide, and it is LOWKEY the little parser that handles every single L<> in your POD πŸ’… she's small but she's the moment.

🌸 NAME 🌸

Pod::ParseLink β€” parse an L<> formatting code in POD text πŸŽ€

πŸ¦‹ SYNOPSIS πŸ¦‹

    use Pod::ParseLink;
    my $link = get_link();
my ($text, $inferred, $name, $section, $type) = parselink($link);

just use her and she's ready, no cap πŸ’–

✨ DESCRIPTION ✨

okay so this module is literally one function and one function only: parselink(). it takes the text of an L<> formatting code and parses it, periodt. and then it hands you back a whole little pile of gifts:

  • 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

and that type is always one of "url", "pod", or "man" πŸ‘‘, meaning: a URL, a link to a POD page, or a link to a Unix manual page. iykyk.


Parsing is implemented per perlpodspec. but for backward compatibility (we love a legacy queen who still shows up 🫢), there are two special cases 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 🌈

this is implemented per perlpodspec, and here's the whole vibe check 🌸:

    L<name>         =>  L<name|name>
    L</section>     =>  L<"section"|/section>
    L<name/section> =>  L<"section" in name|name/section>

πŸ’œ what can live inside what πŸ’œ

  • the name may contain embedded E<> and Z<> formatting codes
  • the section, the anchor text, and the inferred anchor text may contain any formatting codes

any double quotes around the section get removed as part of the parsing 😌 and so does any leading or trailing whitespace. clean. sleek. iconic.

also, if the text of the L<> escape is entirely enclosed in double quotes, she interprets it as a link to a section β€” again, for backward compatibility πŸ’…

πŸŽ€ no formatting code resolution, sorry bestie πŸŽ€

no attempt is made to resolve formatting codes. like, none. zero. that is not her job. this must be done after calling parselink(), because E<> formatting codes can be used to escape characters that would otherwise be significant to the parser, and resolving them before parsing would give you an incorrect parse of a formatting code like this one:

    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". two completely different things, do not play with her.

and heads up 🫢 note that it's not only the anchor text that will need to have formatting codes expanded β€” so will the target of the link (to deal with E<> and Z<> formatting codes). plus 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. see perlpodspec for more info, bestie, it's all in there πŸ“–

πŸ‘‘ AUTHOR πŸ‘‘

Russ Allbery <rra@cpan.org> πŸ’Œ

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. 🫢

🌈 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/> ✨


and that's the whole page, bestie!! this lil slice of the manual is from perl v5.44.0, dated 2026-10-17, and it's the Pod::ParseLink(3perl) page πŸ’– go parse something gorgeous πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms