Data::Microformat::hFeed::hEntry - A module to parse and create hEntries
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);
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.
The microformat class name for an entry; to wit, "hentry"
This is a method to list all the fields on an address that can hold exactly one value.
This is a method to list all the fields on an address that can hold multiple values.
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.
The id of this entry.
The title of this entry.
The base of this entry if available.
The permalink of this entry.
The summary of this entry if available.
The contents of this entry if available.
When this entry was created - returns a DateTime object.
When this entry was modified - returns a DateTime object.
All the tags for this entry.
The author of this entry. Returns a Data::Microformat::hCard object.
The geo location information for this entry. Returns a Data::Microformat::geo object.
Return this hEntry as HTML
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.
bug-data-microformat at rt.cpan.org
Simon Wistow, <swistow@sixapart.com>
<swistow@sixapart.com>
Copyright 2008, Six Apart Ltd. All rights reserved.
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.
To install Data::Microformat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Microformat
CPAN shell
perl -MCPAN -e shell install Data::Microformat
For more information on module installation, please visit the detailed CPAN module installation guide.