
AddressBook - Abstract class for using AddressBooks

use AddressBook;
$a = AddressBook->new(source => "LDAP:localhost");
$b = AddressBook->new(source => "DBI:CSV:f_dir=/tmp/data");
$c = AddressBook->new(source => "PDB");
$a->search(name => "hersh");
$entry = $a->read;
$b->add($entry);
$entry = AddressBook::Entry->new(attr=>{name => "dleigh"});
$c->write($entry);
AddressBook::sync(master=>$a,slave=>$c);

AddressBook provides a unified interface to access various databases for keeping track of contacts. Included with this module are several backends:
AddressBook::DB::LDAP AddressBook::DB::LDIF AddressBook::DB::DBI AddressBook::DB::PDB AddressBook::DB::Text AddressBook::DB::HTML
More will be added in the future.
Create a new AddressBook object.
AddressBook->new(source=$source,\%args)
See the appropriate backend documentation for constructor details.
AddressBook::sync(master=>$master_db, slave=>$slave_db) AddressBook::sync(master=>$master_db, slave=>$slave_db,debug=>1)
Synchronizes the "master" and "slave" databases. The "master" database type must be one that supports random-access methods. The "slave" database type must be one that supports sequential-access methods.
When the 'debug' option is true, debug messages will be printed to stdout. The msg_function paramater, if included, should be a subroutine reference which will be called with a status message is the argument.
The 'merging' of the master and slave entries involves taking each attribute in the slave's entry and replacing the corresponding attribute in the master's entry. Note that attributes that are deleted only on the slave are therefore effectively ignored during synchronization.
Similarly, deletions made on the slave database are effectively ignored during synchronization.
$abook->search(attr=>\%filter);
while ($entry=$abook->read) {
print $entry->dump;
}
\%filter is a list of cannonical attribute/value pairs.
$entry=$abook->read;
Returns an AddressBook::Entry object
$abook->update(filter=>\%filter,entry=>$entry)
\%filter is a list of cannonical attriute/value pairs used to identify the entry to be updated.
$entry is an AddressBook::Entry object
$abook->add($entry)
$entry is an AddressBook::Entry object
$abook->delete($entry)
$entry is an AddressBook::Entry object
$abook->truncate
Removes all records from the database.
@names = $abook->get_attribute_names;
Returns a list of valid backend-specific attribute names
@names = $abook->get_cannonical_attribute_names;
Returns a list of valid cannonical attribute names

Mark A. Hershberger, <mah@everybody.org> David L. Leigh, <dleigh@sameasiteverwas.net>

The perl-abook home page at http://perl-abook.sourceforge.net
AddressBook::Config AddressBook::Entry
AddressBook::DB::LDAP AddressBook::DB::LDIF AddressBook::DB::DBI AddressBook::DB::PDB AddressBook::DB::Text AddressBook::DB::HTML