#!perl -w use strict; use Data::Microformat::hCard; use Test::More tests => 26; #Basic card taken from the microformats wiki: http://microformats.org/wiki/hcard #CSS nonsense taken from http://thegestalt.org/simon, see 0.04 changelog my $simple = << 'EOF';
CommerceNet
Work:
169 University Avenue
Palo Alto, CA 94301
USA
Work +1-650-289-4040
Fax +1-650-289-4041
Email:
GEO: 37.386013, -122.082932
EOF ok(my $card = Data::Microformat::hCard->parse($simple)); is($card->fn, "CommerceNet"); is($card->url, "http://www.commerce.net/"); is($card->org->organization_name, "CommerceNet"); is($card->n->given_name, undef); ok(my @adrs = $card->adr); is(scalar @adrs, 1); ok(my $adr = $adrs[0]); is($adr->type, "Work"); is($adr->street_address, "169 University Avenue"); is($adr->extended_address, undef); is($adr->locality, "Palo Alto"); is($adr->region, "CA"); is($adr->postal_code, "94301"); is($adr->country_name, "USA"); ok(my $geo = $card->geo); is($geo->latitude, "37.386013"); is($geo->longitude, "-122.082932"); ok(my @tel = $card->tel); is(scalar @tel, 2); ok(my $t = $tel[0]); is($t->type, "Work"); is($t->value, "+1-650-289-4040"); ok($t = $tel[1]); is($t->type, "Fax"); is($t->value, "+1-650-289-4041");