NAME
Data::Microformat::hFeed::hEntry - A module to parse and create hEntries
SYNOPSIS
use Data::Microformat::hFeed::hEntry;
my $entry = Data::Microformat::hFeed:hEntry->parse($a_web_page);
print "Entry title is ".$entry->title;
print "Entry author is ".$entry->author->fullname;
# Create a new entry from scratch
my $entry = Data::Microformat::hFeed::hEntry->new;
$entry->id(rand().time().$$);
$entry->title("A title");
$entry->link("http://example.com/989691066");
$entry->summary("A summary");
$entry->content("Somebody did something");
$entry->issued(DateTime->now);
$entry->modified(DateTime->now);
foreach my $tag (qw(tag1 tag2 tag3)) {
$entry->tags($tags);
}
$entry->author($hcard);
DESCRIPTION
An hEntry is a microformat used in hFeeds.
This module exists both to parse existing hEntires from web pages, and to create new hEntries so that they can be put onto the Internet.
To use it to parse an existing hEntry (or hEntries), simply give it the content of the page containing them (there is no need to first eliminate extraneous content, as the module will handle that itself):
my $entry = Data::Microformat::hFeed::hEntry->parse($content);
If you would like to get all the entries on the webpage, simply ask using an array:
my @entries = Data::Microformat::hFeed::hEntry->parse($content);
To create a new hEntry, first create the new object:
my $entry = Data::Microformat::hFeed::hEntry->new;
Then use the helper methods to add any data you would like. When you're ready to output in the hEntry HTML format, simply write
my $output = $entry->to_html;
And $output will be filled with an hEntry representation, using <div> tags exclusively with the relevant class names.
SUBROUTINES/METHODS
class_name
The microformat class name for an entry; to wit, "hentry"
singular_fields
This is a method to list all the fields on an address that can hold exactly one value.
plural_fields
This is a method to list all the fields on an address that can hold multiple values.
Data::Microformat::organization->from_tree($tree [, $source_url])
This method overrides but provides the same functionality as the method of the same name in Data::Microformat, with the optional addition of $source_url. If present, this latter term will set the base of the entry automatically.
id
The id of this entry.
title
The title of this entry.
base
The base of this entry if available.
link
The permalink of this entry.
summary
The summary of this entry if available.
content
The contents of this entry if available.
issued
When this entry was created - returns a DateTime object.
modified
When this entry was modified - returns a DateTime object.
tags
All the tags for this entry.
author
The author of this entry. Returns a Data::Microformat::hCard object.
geo
The geo location information for this entry. Returns a Data::Microformat::geo object.
to_html
Return this hEntry as HTML
BUGS
Please report any bugs or feature requests to bug-data-microformat at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Microformat. I will be notified,and then you'll automatically be notified of progress on your bug as I make changes.
AUTHOR
Simon Wistow, <swistow@sixapart.com>
COPYRIGHT
Copyright 2008, Six Apart Ltd. All rights reserved.
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.