NAME¶
HTML::Microformats::Format::hCard - the hCard microformat
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¶
- •
- "to_vcard"
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.
- •
- "to_vcard4"
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.
- •
- "to_vcard4_xml"
This method exports the hCard as a vCard XML. It requires RDF::vCard and
XML::LibXML to work, and will throw an error at run-time if it's not
available.
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 "has-a/is-a issue", 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 FOAF
(<
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/>.
SEE ALSO¶
HTML::Microformats::Format, HTML::Microformats.
AUTHOR¶
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT¶
Copyright 2008-2011 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.