HTML::...Format(3pm)

πŸ‘‘ HTML::...Format β€” the base microformat class, bestie

okay so this is HTML::...Format(3pm), from the User Contributed Perl Documentation, and it's literally the blueprint every other microformat class is built on. it's the mother, the blueprint, the blueprint-mother. let's get into it πŸ’…


✨ NAME ✨

HTML::Microformats::Format β€” the base microformat class, fr fr.


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: HTML::Microformats::Format cannot be instantiated directly. nope, not even once. it's the parent class, and a whole bunch of other classes inherit from it. it's giving founding mother energy πŸ‘‘

🌸 Constructors 🌸

bestie, listen β€” the constructors cannot actually be called on this package. call them on the descendent classes instead. i know, i know. it's giving "look but don't touch".
  • $object = HTML::Microformats::Format->new($element, $context, %options) β€” parses a microformat with root element $element. that's the whole vibe.
  • $object = HTML::Microformats::Format->extract_all($element, $context, %options) β€” finds and parses all such microformats within element $element. all of them. every single one. no crumbs left behind πŸ“

πŸ’– Public Methods - Accessors πŸ’–

there are a bunch of property accessor methods defined via Perl's AUTOLOAD mechanism. magic? kinda. iconic? absolutely.

for any microformat property (e.g. 'fn' in hCard) there are get_X, set_X, add_X and clear_X methods defined. yes, all four. the whole squad 🫢

  • get_X β€” for singular properties, returns the value of property X. for plural properties, returns a list of values if called in list context, or the first value otherwise. context-sensitive queen ✨
  • set_X β€” for singular properties, sets the value of property X to the first given parameter. for plural properties, sets the values of property X to the list of parameters. > ⚠️ This feature is deprecated and will be removed in a future release.
  • add_X β€” for singular properties, sets the value of property X to the first given parameter, but croaks if X is already set. for concatenated singular properties, concatenates to the end of any existing value of X. for plural properties, adds any given parameters to the list of values of property X. > ⚠️ This feature is deprecated and will be removed in a future release.
  • clear_X β€” removes any values of property X, but croaks if the property is a required property. it said "no 🚫" > ⚠️ This feature is deprecated and will be removed in a future release.

for example, an HTML::Microformats::hCard object will have:

  • a method called get_fn which gets the value of the hCard's "fn" property,
  • a method called set_fn which sets it,
  • a method called add_fn which also sets it (but croaks if it's already set),
  • and a method called clear_fn which croaks if called β€” because "fn" is a required property. rip clear_fn, you never stood a chance 😭

Deprecated features: the set_X, add_X and clear_X methods are deprecated and will be removed soon. in general you should treat objects which are instances of HTML::Microformats::Format as read-only. hands off the merchandise, bestie πŸ™ˆ

🌈 Public Methods - Other 🌈

  • $object->format_signature or $class->format_signature β€” this method may be called as a class or object method. it returns various information about the definition of this microformat (e.g. what is the root class, which properties exist, etc). > ngl you may need to do some digging to figure out what everything means. it's giving cryptic text from the group chat πŸ“±
  • $object->profiles or $class->profiles β€” this method may be called as a class or object method. it returns HTML profile URIs which indicate the presence of this microformat.
  • $object->context β€” returns the parsing context (as supplied to "new").
  • $object->data β€” returns a hashref of object data. > ⚠️ this is a reference to the live data inside the object. any changes to the returned hashref will change the values inside the object. it's not a copy, it's the actual thing. be careful, that's main character responsibility πŸ”₯
  • $object->element β€” returns the root element.
  • $object->cache β€” shortcut for $object->context->cache. short and sweet πŸ’…
  • $object->id([$trine_obj], [$role]) β€” returns a blank node identifier or identifying URI for the object.
    • if $trine_obj is true, the return value is an RDF::Trine::Node object. otherwise, it's a string (using the '_:' convention to identify blank nodes).
    • if $role is undefined, then returns the identifier for the object itself. if it's defined then it returns an identifier for a resource with a fixed relationship to the object.
$identifier_for_business_card  = $hcard->id;
$identifier_for_person         = $hcard->id(undef, 'holder');
  • $object->add_to_model($model) β€” given an RDF::Trine::Model object, adds relevant data to the model.
  • $object->model β€” creates a fresh, new RDF::Trine::Model object, containing relevant data. brand new, fresh out the box ✨
  • $object->serialise_model(as => $format) β€” as "model" but returns a string. same vibe, different delivery πŸ’Œ

πŸ’€ BUGS πŸ’€

please report any bugs to <http://rt.cpan.org/>. they're listening, bestie πŸ‘€


🧚 SEE ALSO 🧚

HTML::Microformats.


πŸŽ€ AUTHOR πŸŽ€

Toby Inkster <tobyink@cpan.org>. the icon, the legend πŸ‘‘


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.

not me shouting the disclaimer but it's in all caps in the original so it's staying in all caps, periodt πŸ“£

and that's the whole page, bestie πŸ’– this was HTML::...Format(3pm) from perl v5.32.1, dated 2021-09-12. stay iconic, stay read-only, and don't touch the live hashref πŸ¦‹βœ¨

πŸ“¦ where this page comes from