package Data::Microformat::adr; use base qw(Data::Microformat); use strict; use warnings; our $VERSION = "0.03"; sub class_name { "adr" } sub plural_fields { qw(type) } sub singular_fields { qw(post_office_box street_address extended_address locality region postal_code country_name) } 1; __END__ =head1 NAME Data::Microformat::adr - A module to parse and create adrs =head1 VERSION This documentation refers to Data::Microformat::adr version 0.03. =head1 SYNOPSIS use Data::Microformat::adr; my $adr = Data::Microformat::adr->parse($a_web_page); print "The street address we found in this adr was:\n"; print $adr->street_address."\n"; # To create a new adr: my $new_adr = Data::Microformat::adr->new; $new_adr->street_address("548 4th St."); $new_adr->locality("San Francisco"); $new_adr->region("CA"); $new_adr->postal_code("94107"); $new_adr->country_name("USA"); print "Here's the new adr I've just made:\n"; print $new_adr->to_hcard."\n"; =head1 DESCRIPTION An adr is the address microformat used primarily in hCards. It exists as its own separate specification. This module exists both to parse existing adrs from web pages, and to create new adrs so that they can be put onto the Internet. To use it to parse an existing adr (or adrs), 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 $adr = Data::Microformat::adr->parse($content); If you would like to get all the adrs on the webpage, simply ask using an array: my @adrs = Data::Microformat::adr->parse($content); To create a new adr, first create the new object: my $adr = Data::Microformat::adr->new; Then use the helper methods to add any data you would like. When you're ready to output the adr in the hCard HTML format, simply write my $output = $adr->to_hcard; And $output will be filled with an hCard representation, using