The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::vCard - Read and write vCard files (RFC 2426). vCard files hold personal information that you would typically find on a business card. Name, numbers, addresses, and even logos. This module can also serve as a base class for other vFile readers.

SYNOPSIS

  use Net::vCard;

  my $cards=Net::vCard->loadFile( "addresses.vcf" );

  foreach my $card ( @$cards ) {

    print $card->givenName,       " ",  $card->familyName, "\n";
    print $card->ADR->address,    "\n"; 
    print $card->ADR->city,       " ",  $card->ADR->region, "\n";
    print $card->ADR->postalCode, "\n";

    print $card->ADR("home")->address,    "\n"; 
    print $card->ADR("home")->city,       " ",  $card->ADR("home")->region, "\n";
    print $card->ADR("home")->postalCode, "\n";

  }

MODULE STATUS

The current state of this module is a pretty solid parser and internal data structure.

Now I will be adding get/set handlers for the various properties. As well, I'd really like to get some pathelogical data from different vCard producers. Right now I have a pretty good handle on Apple's Addressbook - which is the whole reason why I wrote this stuff.

For those who really want to use this module right away

  - go ahead and access the hash values directly for the time being
  - keep in mind that I will be making a get/set method interface
  - once that is established you will need to use that interface instead

ACCESSOR METHODS

NAME values

$vcard->familyName( [ familyName ] )
$vcard->givenName( [ givenName ] )
$vcard->additionalNames( [ additionalNames ] )
$vcard->suffixes( [ suffixes ] )
$vcard->prefixes( [ prefixes ] )

ADDRESSES

To access address data:

 $card->ADR( type )->field;
 $card->ADR( )->city;           # Default address, city field
 $card->ADR( "home" )->address; # Home address type, address field
$card->ADR( [type] )->country
$card->ADR( [type] )->poBox
$card->ADR( [type] )->city
$card->ADR( [type] )->region
$card->ADR( [type] )->address
$card->ADR( [type] )->postalCode
$card->ADR( [type] )->extendedAddress

There are some decisions to be taken wrt ADR values.

Firstly

As of now the RFC specifies action to take in the case of unlisted type - the address gets four types - intl, parcel, postal, and work. This implies that several types refer to the same address.

What I am doing for loading this data is storing the address in a hash entry by the first name and listing the remainder in "_alias" hash key.

What happens when one of these addresses is updated? Do we copy all the values to unique hash entries or do we update the common copy, requiring the developer to explicitly declare a new address replace the common entry.

If this doesn't make sense email me and I'll try another explaination.

Secondly

What about preferred addresses? For now I am going to let the module user optionally request their preferred address type. If it does not exist then we'll keep looking for less preferred address types like the "pref" that was specified when loading vcard data, and finally the 4 default types.

SUPPORT

For technical support please email to jlawrenc@cpan.org ... for faster service please include "Net::vCard" and "help" in your subject line.

AUTHOR

 Jay J. Lawrence - jlawrenc@cpan.org
 Infonium Inc., Canada
 http://www.infonium.ca/

COPYRIGHT

Copyright (c) 2003 Jay J. Lawrence, Infonium Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

ACKNOWLEDGEMENTS

 Net::iCal - whose loading code inspired me for mine

SEE ALSO

RFC 2426, Net::iCal