NAME

Net::CardDAVTalk - A library for talking to CardDAV servers

VERSION

Version 0.11

SYNOPSIS

This module maps from CardDAV to an old version of the FastMail API. It's mostly useful as an example of how to talk CardDAV and for the Cyrus IMAP test suite Cassandane.

use Net::CardDAVTalk;

my $foo = Net::CardDAVTalk->new();
...

SUBROUTINES/METHODS

$class->new()

Takes the same arguments as Net::DAVTalk and adds the single namespace:

C => 'urn:ietf:params:xml:ns:carddav'

$self->NewAddressBook($Path, %Args)

Creates a new addressbook collection. Requires the full path (unlike Net::CalDAVTalk, which creates paths by UUID) and takes a single argument, the name:

e.g.

$CardDAV->NewAddressBook("Default", name => "Addressbook");

$self->DeleteAddressBook($Path)

Deletes the addressbook at the given path

e.g.

$CardDAV->DeleteAddressBook("Shared");

$self->UpdateAddressBook($Path, %Args)

Like 'new', but for an existing addressbook. For now, can only change the name.

e.g.

$CardDAV->UpdateAddressBook("Default", name => "My Happy Addressbook");

$self->GetAddressBook($Path, %Args)

Calls 'GetAddressBooks' with the args, and greps for the one with the matching path.

e.g.

my $AB = $CardDAV->GetAddressBook("Default");

$self->GetAddressBooks(%Args)

Get all the addressbooks on the server.

Returns an arrayref of hashrefs

e.g.

my $ABs = $CardDAV->GetAddressBooks(Sync => 1);
foreach my $AB (@$ABs) {
    say "$AB->{path}: $AB->{name}";
}

$Self->NewContact($AddressBookPath, $Card)

Create a new contact from a JSContact Card hashref. Generates a UID if not present.

Returns the full path to the card.

$self->DeleteContact($Path)

Delete the contact at path $Path.

$Self->UpdateContact($Path, $Card)

Like NewContact, but updates an existing contact. Takes the full path and a JSContact Card hashref.

$Self->GetContact($Path)

Fetch a specific contact by path. Returns a JSContact Card hashref.

$Self->GetContactAndProps($Path, $Props)

Use a multiget to fetch the properties in the arrayref as well as the card content.

Returns the card in scalar context - the card and an array of errors in list context.

$self->GetContacts($Path, $Props, %Args)

Get multiple cards, possibly including props, using both a propfind AND a multiget.

Returns an arrayref of contact and an arrayref of errors (or just the contacts in scalar context again)

$self->GetContactLinks($Path)

Returns a hash of href => etag for every contact URL (type: text/(x-)?vcard) inside the collection at \$Path.

$self->GetContactsMulti($Path, $Urls, $Props)

Does an addressbook-multiget on the \$Path for all the URLs in \$Urls also fetching \$Props on top of the address-data and getetag.

$self->SyncContacts($Path, $Props, %Args)

uses the argument 'syncToken' to find newly added and removed cards from the server. Returns just the added/changed contacts in scalar context, or a list of array of contacts, array of removed, array of errors and the new syncToken as 4 items in list context.

$self->SyncContactLinks($Path, %Args)

uses the argument 'syncToken' to find newly added and removed cards from the server.

Returns a list of:

* Hash of href to etag for added/changed cargs * List of href of removed cards * List of errors * Scalar value of new syncToken

$self->MoveContact($Path, $NewPath)

Move a contact to a new path (usually in a new addressbook) - both paths are card paths.

AUTHOR

Bron Gondwana, <brong at cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-carddavtalk at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-CardDAVTalk. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::CardDAVTalk

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2015-2026 Fastmail Pty Ltd.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself; that is, either the GNU General Public License as published by the Free Software Foundation (version 1, or at your option any later version), or the Artistic License.

See http://dev.perl.org/licenses/ and the LICENSE file included with this distribution for more information.