Text::Microformat::Element::rel_tag - a rel-tag element


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

Index


Code Index:

NAME

Top

Text::Microformat::Element::rel_tag - a rel-tag element

SYNOPSIS

Top

    To add rel-tag to a Text::Microformat schema:

    package Text::Microformat::Element::hMyFormat
    __PACKAGE__->init(
        'my-format',
        schema => {
            tags => 'rel-tag',
        }
    );

    To then retrieve tags from a Text::Microformat::Element::hMyFormat instance:

    foreach my $tag (@{$format->tags}) {
        print $tag->MachineValue, "\n"; # print the href
        print $tag->HumanValue, "\n"; # print the tag word
    }

SEE ALSO

Top

Text::Microformat, http://microformats.org/wiki/rel-tag

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::rel_tag;
use warnings;
use strict;
use base 'Text::Microformat::Element';

__PACKAGE__->_init({
    criteria => {
        rel => 'tag',
    },
});

sub MachineValue {
	my $self = shift;
	my $tag = defined $self->_element->local_name ? $self->_element->local_name : "";
	if ($tag eq 'a') {
		return $self->_element->attr('href');
	}
	else {
	    return undef;
	}
}


1;