HTML::...::XMDP(3pm)

πŸ’– HTML::...::XMDP(3pm) β€” aka the XMDP microformat, bestie edition πŸ’–

okay so hi, you found the manpage for HTML::Microformats::Format::XMDP, which is a Perl module living in the HTML::...::XMDP slot of the User Contributed Perl Documentation. it's the XMDP microformat handler and it's lowkey iconic, so let's get into it 🫢


✨ NAME ✨

HTML::Microformats::Format::XMDP β€” the XMDP microformat. that's it, that's the whole name, no notes πŸ’…


🌸 SYNOPSIS 🌸

here's the vibe, literally copy-paste coded:

use HTML::Microformats;
use LWP::Simple qw[get];
use RDF::TrineShortcuts;

my $uri  = 'http://microformats.org/profile/hcard';
my $html = get($uri);
my $doc  = HTML::Microformats->new_document($html, $uri);
$doc->assume_all_profiles;

my @xmdp_objects = $doc->objects('XMDP');
foreach my $xo (@xmdp_objects)
{
  print $xo->serialise_model(
      as         => 'Turtle',
      namespaces => {
          rdfs  => 'http://www.w3.org/2000/01/rdf-schema#',
          hcard => 'http://microformats.org/profile/hcard#',
          },
      );
  print "########\n\n";
}

so you grab a URI, fetch the HTML with LWP::Simple's get, build a document, tell it to assume_all_profiles, then pull out all the 'XMDP' objects with objects and serialise each one's model as Turtle with your custom namespaces hash. then you print a little "########\n\n" divider between them because we're organised and we're cute πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

HTML::Microformats::Format::XMDP inherits from HTML::Microformats::Format. so if you're wondering about the property getter/setter methods, the constructors, all that good stuff β€” go read the base class definition, it's all spelled out there. not me redirecting you, but also yes me redirecting you πŸ’€

and plot twist: HTML::Microformats::Format::XMDP also inherits from HTML::Microformats::Format::XOXO, and the "data" method returns the exact same structure. family tree moment, the way that it shares dna 😭


🌈 MICROFORMAT 🌈

HTML::Microformats::Format::XMDP supports XMDP as described at <http://gmpg.org/xmdp/>. go read the spec, bestie, it's right there 🧚


πŸ‘‘ RDF OUTPUT πŸ‘‘

the data comes back using RDFS. no cap. ⭐


πŸ’€ BUGS πŸ’€

okay here's the one thing you need to know, and I'm saying it dramatically because it matters: a limitation is that for any <dd> element with <dl> children, only the first such <dl> is looked at. so what does that mean for you? it means the XFN 1.1 profile document is only partially parsable. 😭 most other microformat profile documents can be properly parsed though, so like, it's giving very specific edge case, but still β€” be aware.

and if you find bugs, please report any bugs to <http://rt.cpan.org/>. do it for the culture πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

  • HTML::Microformats::Format
  • HTML::Microformats

go read those too, iykyk 🫢


πŸŽ€ AUTHOR πŸŽ€

Toby Inkster <tobyink@cpan.org>. absolute legend, we stan πŸ‘‘


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. slay, permissive licensing, we love to see it ✨


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

read it and weep bestie, no warranty, we're all just vibing on our own πŸ’…


and that's the whole page!! this lil doc is from perl v5.32.1, dated 2021-09-12, and it's part of the User Contributed Perl Documentation β€” so yeah, contributed by the people, for the people. mwah, go parse some profiles πŸ¦‹πŸ’–

πŸ“¦ where this page comes from