PFT::Map::Node(3)

πŸ“¦ version 1.4.1, in fedora 43, fedora 44

πŸ’– PFT::Map::Node πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation β€” it's the manual for PFT::Map::Node(3), and honestly? it's giving ✨backbone of the whole site map✨. let's get into it.


🌸 NAME 🌸

PFT::Map::Node β€” a single node of a PFT site map. yes, just one lil node. she's part of a bigger picture, iykyk πŸ¦‹


✨ SYNOPSIS ✨

PFT::Map::Node->new($seqnr, $id, $content);
PFT::Map::Node->new($seqnr, $id, undef, $header);
PFT::Map::Node->new($seqnr, $id, $content, $header);

three ways to birth a node, pick your fighter πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so PFT::Map::Node objects are literally the nodes of the site map, and they get created inside a PFT::Map object. each node has two identifiers: a unique sequence number, and a mnemonic identifier. periodt.

the first form of the constructor up in the SYNOPSIS makes a PFT::Map::Node without giving it a header β€” which is totally allowed, because you handed it a content item (a PFT::Map::Content::Base instance). the constructor will make an attempt to read the header for you. 🫢

the second and third forms are the ones you use when the header is already available β€” like, as an optimization so the system doesn't have to go fetch it all over again β€” or in those situations where the header just cannot be retrieved at all. no cap.

heads up bestie: the header cannot be retrieved from entries that don't correspond to a real file. those are called virtual contents, and nodes pointing at them are virtual nodes. they represent auto-generated pages within a PFT site β€” the typical case being tag pages and month pages. 🌈

see the PFT::Map::Node implementation for further details (go read the source, it's right there πŸ’œ).

🌸 Properties 🌸

  • header β€” the header associated with this node.

this property could return undef if the node is associated with a non-textual content β€” like, something which is a PFT::Content::Base but not a PFT::Content::Entry. 😭

  • content β€” the content associated with this node.

this property could return undefined for the nodes that don't correspond to any content.

  • date β€” returns the date of the content, or undef if the content isn't recording any date.
  • seqnr β€” returns the sequential id of the node.

reported verbatim as by constructor parameter. no edits, no glow-up, just as you gave it πŸ’…

  • id β€” returns the mnemonic identifier, unique for the whole site.

also reported verbatim as by constructor parameter. iconic.

  • title β€” returns the title of the content.

the title is retrieved from the header. content items like pictures don't have a header, so they don't have a title β€” and undef is what you get back if that's the case. πŸ™ˆ

  • author β€” returns the author of the content.

the author is retrieved from the header. content items like pictures don't have a header, so they don't have an author β€” undef is returned if that's the case. same energy as title, fr fr.

  • virtual β€” returns 1 if the node is virtual. that's it, that's the whole vibe check βœ…
  • content_type β€” returns the type of the content. short for ref($node->content).
not me clarifying this but: this has nothing to do with the HTTP content-type header (nor with HTTP at all, bestie). don't @ me. πŸ’€

πŸ¦‹ Routing properties πŸ¦‹

routing properties let you access other nodes. like, the prev property of a node corresponds to the previous node in the chronological sense. and yeah, they can be undef β€” e.g. if the node doesn't have a predecessor, there's just nobody there. πŸ₯²

the properties are:

  • "prev": previous node;
  • "next": next node;
  • "tags": list of tag nodes, possibly virtual;
  • "tagged": non-empty only for tag nodes, list of tagged nodes;
  • "days": non-empty only for month nodes, list of days in the month;
  • "inlinks": list of nodes whose text is pointing to this node;
  • "outlinks": links of node pointed by the text of this node;
  • "children": union of "tagged" and "days"
  • "symbols": list of symbols referenced in the text, sorted by occurrence

other methods are defined as setters for the properties mentioned above. they're currently not documented, but they get used in PFT::Map. (mysterious. we love a secretive queen πŸ‘‘)

πŸ’œ More complex methods πŸ’œ

  • html β€” expand the HTML of the content, translating outbound links into hyper-references (hrefs).

it requires, as a parameter, a callback mapping a PFT::Map::Node object into a string representing a path within the site. the callback gets applied to all symbols, and the resulting string will replace the symbol placeholder in the HTML. πŸ”₯

returns a string HTML β€” or an empty string if the node is virtual. that's the whole deal. ✨


and that's the page bestie!! this was PFT::Map::Node(3) from the User Contributed Perl Documentation, brought to you by perl v5.42.0, dated 2025-07-25. go forth and map your site, you absolute main character πŸ«ΆπŸŽ€πŸŒΈβœ¨

πŸ“¦ where this page comes from