Data::Microformat - A base class for hCards and related modules
This documentation refers to Data::Microformat version 0.03.
This is the base class used for a variety of modules in Data::Microformat. It contains several helpful methods to reduce code duplication. It shouldn't be instantiated on its own (as it won't do anything useful), but can be used as a base class for other Data::Microformat modules.
This method creates a new instance of whatever subclass on which it was called.
This method should not be called directly on Data::Microformat, as it will not be particularly useful.
This method simply takes the content passed in and makes an HTML tree out of it, then hands it off to the from_tree method to do the actual interpretation. Should you have an HTML::Element tree already, there is no need to parse the content again; simply pass the tree's root to the from_tree method.
If you are calling this method on the hCard class, you can pass an additional parameter of the source URL, and this will allow the representative hCard to be determined. This parameter is optional.
This method takes an HTML::Element tree and finds microformats in it. It will return one or many of the calling class (assuming it finds them) depending on the call; if called in array context, it will return all that it finds, and if called in scalar context, it will return just one.
The module tries hard not to require absolute adherence to the published specifications, but there is only so much flexibility it can have. It does not require that all the "required" information be present in a microformat-- just that what is there be reasonably well-formatted, enough to make parsing possible.
Certain modules may override this if they have specific parsing concerns.
This method, called on an instance of Data::Microformat or its subclasses, will return an hCard HTML representation of the data present. This is most likely to be used when building your own microformatted data, but can be called on parsed content as well. The returned data is very lightly formatted, and it uses only <div> tags for markup, rather than <span> tags.
to_hcard is a synonym for to_html.
This method, called on an instance of Data::Microformat or its subclasses, will return a plain text representation of the data present. This format uses indentation to show nesting, and attempts to be easily human-readable.
This module relies upon the following other modules:
Which can be obtained from CPAN.
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
Brendan O'Connor, <perl at ussjoin.com>
<perl at ussjoin.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.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.