SYNOPSIS

 use HTML::Microformats::DocumentContext;
 use HTML::Microformats::Format::hCard;

 my $context = HTML::Microformats::DocumentContext->new($dom, $uri);
 my @cards   = HTML::Microformats::Format::hCard->extract_all(
                   $dom->documentElement, $context);
 foreach my $card (@cards)
 {
   print $card->get_fn . "\n";
 }

DESCRIPTION

HTML::Microformats::Format::hCard inherits from HTML::Microformats::Format. See the base class definition for a description of property getter/setter methods, constructors, etc.

Additional Method

  • \*(C`to_vcard\*(C' This method exports the hCard as a vCard 3.0. It requires RDF::vCard to work, and will throw an error at run-time if it's not available.

  • \*(C`to_vcard4\*(C' This method exports the hCard as a vCard 3.0. It requires RDF::vCard to work, and will throw an error at run-time if it's not available.

  • \*(C`to_vcard4_xml\*(C' This method exports the hCard as a vCard \s-1XML\s0. It requires RDF::vCard and XML::LibXML to work, and will throw an error at run-time if it's not available.

MICROFORMAT

HTML::Microformats::Format::hCard supports hCard as described at <http://microformats.org/wiki/hcard>, with the following additions:

  • vCard 4.0 terms This module includes additional property terms taken from the latest vCard 4.0 drafts. For example the property 'impp' may be used to mark up instant messaging addresses for a contact. The vCard 4.0 property 'kind' is used to record the kind of contact described by the hCard (an individual, an organisation, etc). In many cases this is automatically inferred.

  • Embedded species microformat If the species microformat (see HTML::Microformats::Format::species) is found embedded within an hCard, then this is taken to be the species of a contact.

  • Embedded hMeasure If the hMeasure microformat (see HTML::Microformats::Format::hMeasure) is found embedded within an hCard, and no 'item' property is provided, then the measurement is taken to pertain to the contact described by the hCard.

RDF OUTPUT

Data is returned using the W3C's vCard vocabulary (<http://www.w3.org/2006/vcard/ns#>) with some supplemental terms from Toby Inkster's vCard extensions vocabulary (<http://buzzword.org.uk/rdf/vcardx#>) and occasional other terms.

After long deliberation on the \*(L"has-a/is-a issue\*(R", the author of this module decided that the holder of a vCard and the vCard itself should be modelled as two separate resources, and this is how the data is returned. Some information about the holder of the vCard can be inferred from information about the vCard; for instance, the vCard's fn property can be used to determin the holder's foaf:name. This module uses \s-1FOAF\s0 (<http://xmlns.com/foaf/0.1/>) to represent information about the holder of the vCard.

BUGS

Please report any bugs to <http://rt.cpan.org/>.

RELATED TO HTML::Microformats::Format::hCard…

HTML::Microformats::Format, HTML::Microformats.

AUTHOR

Toby Inkster <[email protected]>.

COPYRIGHT AND LICENCE

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

\s-1THIS\s0 \s-1PACKAGE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.