Text::vCard trouble

[email protected] (Bill Stephenson) Mon, 5 Jan 2009 15:55:47 -0600
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
I want to use Text::vCard to import Address Book data and put that data 
into a CGI.pm object.

So far I can break out the name and address from a vCard but I can't 
seem to access the phone number data.

Below is the script I'm building for this. Can anyone spot what I'm 
doing wrong?

Kindest Regards,

--
Bill Stephenson

<code>

#!/usr/local/bin/perl

use strict;
use Text::vCard;
use Text::vCard::Addressbook;

my $address_book = Text::vCard::Addressbook->new({
	'source_file' => 
'/Library/WebServer/CGI-Executables/test/vCard/GroupvCards.vcf',
});

foreach my $vcard ($address_book->vcards()) {

	print $vcard->fullname() ."\n";

	my $addresses = $vcard->get({ 'node_type' => 'addresses' });

	my $address = $addresses->[0];
	
	print $address->street() ."\n";
	print $address->city() ." ";
	print $address->post_code() ."\n";
	print $address->country() ."\n\n";

	print $vcard->email() ."\n";


# these do not work.
#	print $vcard->tel() ."\n";
#	print $vcard->tel->home() ."\n";
#	print $vcard->phones->home() ."\n";


   #this should get all the home and work phone numbers....


	my @types = qw(work home);
	my $nodes = $vcard->get({
		'node_type' => 'tel',
		'types' => \@types,
	});

   # trying print them all out here

	foreach my $node (@$nodes) {


   # I have tried variations on this but
   # cannot get it to print the phone numbers.
   # I get no errors. Nothing.

		print $node->value();
		print $node->home();
		print $node->tel->home();
		
	}

	print "\n==========================\n\n";

}

</code>

Sample vCard used
GroupvCards.vcf

BEGIN:VCARD
VERSION:3.0
N:Galik;Frankie;;;
FN:Frankie Galik
ORG:Cork Massage;
EMAIL;type=INTERNET;type=HOME;type=pref:[email protected]
EMAIL;type=INTERNET;type=WORK:[email protected]
TEL;type=HOME;type=pref:0210000000
TEL;type=CELL:0850000000
TEL;type=WORK:0210000001
item1.ADR;type=HOME;type=pref:;;Test Street;Cork;Cork;;Ireland
item1.X-ABADR:ie
item2.ADR;type=WORK:;;2 Test Street\, Lee Road;Cork;;;Ireland
item2.X-ABADR:ie
CATEGORIES:Ezinvoice Vcard Test
X-ABUID:E8069363-962C-4F44-A1A2-B678C8597D92\:ABPerson
END:VCARD
BEGIN:VCARD
VERSION:3.0
N:Johnston;John;;;
FN:John Johnston
ORG:Apple;
EMAIL;type=INTERNET;type=HOME;type=pref:[email protected]
TEL;type=HOME:+35321000000
TEL;type=CELL;type=pref:+353876666666
TEL;type=WORK:+35321000000
item1.ADR;type=HOME;type=pref:;;17 The Mews\nRiver Towers\, Lee 
Road;Cork;Cork;;
item1.X-ABADR:ie
CATEGORIES:Ezinvoice Vcard Test
X-ABUID:DFBEC94D-55DC-44C6-978E-3AE5CF63EE79\:ABPerson
END:VCARD