HTML::...Context(3pm)

πŸ’– NAME πŸ’–

ok so bestie, welcome to HTML::Microformats::DocumentContext β€” it's literally the context for microformat objects ✨ (perl v5.32.1 vibes, and yes this page is the HTML::...Context(3pm) one πŸŽ€)


🌸 DESCRIPTION 🌸

okay so here's the tea: microformat objects are like, needy. They need context to actually make sense when you're parsing them 🫢 For example, you need a base URI to resolve relative URI references, and you need a full copy of the DOM tree to implement the include pattern. No context, no slay. Periodt.

✨ Constructor ✨

  • $context = HTML::Microformats::DocumentContext->new($dom, $baseuri) β€” creates a new context from a DOM document and a base URI πŸ’…
⚠️ heads up bestie: $dom will be modified, so if you care about keeping it pristine, make a clone first. this is not a drill 😭

πŸ¦‹ Public Methods πŸ¦‹

  • $context->cache β€” a Microformat cache for the context πŸ’– This prevents the same microformat object from being parsed and reparsed β€” like, an adr parsed first in its own right, and later as a child of an hCard. obsessed with the efficiency honestly.
  • $context->document β€” returns the modified DOM document πŸ“„
  • $context->uri( [$relative_reference] ) β€” called without a parameter, it returns the context's base URI. Called with a parameter, it resolves the URI reference relative to the base URI ✨
  • $context->document_uri β€” returns a URI representing the document itself πŸŽ€ (usually the same as the base URI.)
  • $context->make_bnode( [$element] ) β€” mint a blank node identifier or a URI πŸ’… If an element is passed, this may be used to construct a URI in some way.
  • $context->profiles β€” a list of profile URIs declared by the document 🌈
  • $context->has_profile(@profiles) β€” returns true iff any of the profiles in the array are declared by the document πŸ‘‘
  • $context->add_profile(@profiles) β€” declare these additional profiles 🫢
  • $context->representative_hcard β€” returns the hCard for the person that is "represented by" the page (in the XFN sense), or undef if no suitable hCard could be found 😭
  • $context->representative_person_id( [$as_trine] ) β€” equivalent to calling $context->representative_hcard->id($as_trine, 'holder'), however it magically works even if $context->representative_hcard returns undef ✨ lowkey iconic behaviour
  • $context->contact_hcard β€” returns the hCard for the contact person for the page, or undef if none can be found πŸ’œ

hCards are considered potential contact hCards if they are contained within an HTML <address> tag, or their root element is an <address> tag. If there are several such hCards, then the one in the shallowest <address> tag is used; if there are several <address> tags equally shallow, the first is used. iykyk 🌸

  • $context->contact_person_id( [$as_trine] ) β€” equivalent to calling $context->contact_hcard->id($as_trine, 'holder'), however it magically works even if $context->contact_hcard returns undef πŸ’« again with the magic, we love her for it

πŸ’€ BUGS πŸ’€

please report any bugs to <http://rt.cpan.org/> πŸ› bestie if you find one, tell the people, don't just suffer in silence πŸ™ˆ


🌈 SEE ALSO 🌈

  • HTML::Microformats ✨

πŸŽ€ AUTHOR πŸŽ€

Toby Inkster <tobyink@cpan.org> πŸ‘‘


Copyright 2008-2012 Toby Inkster

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself πŸ’–


🫢 DISCLAIMER OF WARRANTIES 🫢

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 🫑 no cap, it really says that, read it and weep


okay bestie that's the whole page, you ate it up πŸ’– this was perl v5.32.1, dated 2021-09-12, and it's the HTML::...Context(3pm) manual β€” go forth and parse those microformats, main character energy only πŸ‘‘βœ¨

πŸ“¦ where this page comes from