Text::Microformat::Element::hCard - hCard plugin for Text::Microformat


Text-Microformat documentation Contained in the Text-Microformat distribution.

Index


Code Index:

NAME

Top

Text::Microformat::Element::hCard - hCard plugin for Text::Microformat

SEE ALSO

Top

Text::Microformat, http://microformats.org/wiki/hcard

AUTHOR

Top

Keith Grennan, <kgrennan at cpan.org>

BUGS

Top

Log bugs and feature requests here: http://code.google.com/p/ufperl/issues/list

SUPPORT

Top

Project homepage: http://code.google.com/p/ufperl/

COPYRIGHT & LICENSE

Top


Text-Microformat documentation Contained in the Text-Microformat distribution.

package Text::Microformat::Element::hCard;
use warnings;
use strict;
use base 'Text::Microformat::Element';

__PACKAGE__->_init({
    criteria => {
        class => 'vcard',
    },
	schema => {
	    fn => [],
	    n => [qw/family-name given-name additional-name honorific-prefix honorific-suffix/],
	    nickname => [],
	    'sort-string' => [],
	    url => 'URI',
	    email => [qw/type value/],
	    tel => [qw/type value/],
	    adr => [qw/post-office-box extended-address street-address locality region postal-code country-name type value/],
	    label => [],
	    geo => [qw/latitude longitude/],
	    tz => [],
	    photo => 'URI',
	    logo => 'URI',
	    sound => 'URI',
	    bday => [],
	    title => [],
	    role => [],
	    org => [qw/organization-name organization-unit/],
	    category => [],
	    note => [],
	    class => [],
	    key => [],
	    mailer => [],
	    uid => [],
	    rev => [],
	},
});

package Text::Microformat::Element::hCard::HasValue;
use warnings;
use strict;
use base 'Text::Microformat::Element';

sub ToHash {
	my $self = shift;
	
	if ($self->value and @{$self->value}) {
		return $self->SUPER::ToHash;
	}
	else {
		return $self->Value;
	}
}

package Text::Microformat::Element::hCard::email;
use warnings;
use strict;
our @ISA = 'Text::Microformat::Element::hCard::HasValue';

package Text::Microformat::Element::hCard::tel;
use warnings;
use strict;
our @ISA = 'Text::Microformat::Element::hCard::HasValue';


1;