1Net::DAVTalk(3)       User Contributed Perl Documentation      Net::DAVTalk(3)
2
3
4

NAME

6       Net::DAVTalk - Interface to talk to DAV servers
7

VERSION

9       Version 0.16
10

SYNOPSIS

12       Net::DAVTalk is was originally designed as a service module for
13       Net::CalDAVTalk and Net::DAVTalk, abstracting the process of connecting
14       to a DAV server and parsing the XML responses.
15
16       Example:
17
18           use Net::DAVTalk;
19           use XML::Spice;
20
21           my $davtalk = Net::DAVTalk->new(
22               url => "https://dav.example.com/",
23               user => "foo\@example.com",
24               password => "letmein",
25           );
26
27           $davtalk->Request(
28               'MKCALENDAR',
29               "$calendarId/",
30               x('C:mkcalendar', $Self->NS(),
31                   x('D:set',
32                        x('D:prop', @Properties),
33                   ),
34               ),
35           );
36
37           $davtalk->Request(
38               'DELETE',
39               "$calendarId/",
40           );
41

SUBROUTINES/METHODS

43   $class->new(%Options)
44       Options:
45
46           url: either full https?:// url, or relative base path on the
47           server to the DAV endpoint
48
49           host, scheme and port: alternative to using full URL.
50           If URL doesn't start with https?:// then these will be used to
51           construct the endpoint URI.
52
53           expandurl and wellknown: if these are set, then the wellknown
54           name (caldav and carddav are both defined) will be used to
55           resolve /.well-known/$wellknown to find the current-user-principal
56           URI, and then THAT will be resovlved to find the $wellknown-home-set
57           URI, which will be used as the URL for all further actions on
58           this object.
59
60           user and password: if these are set, perform basic authentication.
61           user and access_token: if these are set, perform Bearer (OAUTH2)
62           authentication.
63
64   $Self->SetURL($url)
65       Change the endpoint URL for an existing connection.
66
67   $Self->SetPrincipalURL($url)
68       Set the URL to the DAV Principal
69
70   $Self->fullpath($shortpath)
71       Convert from a relative path to a full path:
72
73       e.g
74           my $path = $Dav->fullpath('Default');
75           ## /dav/calendars/user/foo/Default
76
77       NOTE: a you can pass a non-relative full path (leading /) to this
78       function and it will be returned unchanged.
79
80   $Self->shortpath($fullpath)
81       Convert from a full path to a relative path
82
83       e.g
84           my $path = $Dav->fullpath('/dav/calendars/user/foo/Default');
85           ## Default
86
87       NOTE: if the full path is outside the basepath of the object, it will
88       be unchanged.
89
90           my $path = $Dav->fullpath('/dav/calendars/user/bar/Default');
91           ## /dav/calendars/user/bar/Default
92
93   $Self->Request($method, $path, $content, %headers)
94       The whole point of the module!  Perform a DAV request against the
95       endpoint, returning the response as a parsed hash.
96
97          method: http method, i.e. GET, PROPFIND, MKCOL, DELETE, etc
98
99          path: relative to base url.  With a leading slash, relative to
100                server root, i.e. "Default/", "/dav/calendars/user/foo/Default".
101
102          content: if the method takes a body, raw bytes to send
103
104          headers: additional headers to add to request, i.e (Depth => 1)
105
106   $Self->GetProps($Path, @Props)
107       perform a propfind on a particular path and get the properties back
108
109   $Self->GetPropsArray($Path, @Props)
110       perform a propfind on a particular path and get the properties back as
111       an array of one or more items
112
113   $Self->GetCurrentUserPrincipal() =head2
114       $class->GetCurrentUserPrincipal(%Args)
115       Can be called with the same args as new() as a class method, or on an
116       existing object.  Either way it will use the .well-known URI to find
117       the path to the current-user-principal.
118
119       Returns a string with the path.
120
121   $Self->GetHomeSet =head2 $class->GetHomeSet(%Args)
122       Can be called with the same args as new() as a class method, or on an
123       existing object.  Either way it assumes that the created object has a
124       'url' parameter pointing at the current user principal URL (see
125       GetCurrentUserPrincipal above)
126
127       Returns a string with the path to the home set.
128
129   $Self->genuuid()
130       Helper to generate a uuid string.  Returns a UUID, e.g.
131
132           my $uuid = $DAVTalk->genuuid(); # 9b9d68af-ad13-46b8-b7ab-30ab70da14ac
133
134   $Self->auth_header()
135       Generate the authentication header to use on requests:
136
137       e.g:
138
139           $Headers{'Authorization'} = $Self->auth_header();
140
141   $Self->request_url()
142       Generate the authentication header to use on requests:
143
144       e.g:
145
146           $Headers{'Authorization'} = $Self->auth_header();
147
148   $Self->NS()
149       Returns a hashref of the 'xmlns:shortname' => 'full namespace' items
150       for use in XML::Spice body generation, e.g.
151
152           $DAVTalk->Request(
153               'MKCALENDAR',
154               "$calendarId/",
155               x('C:mkcalendar', $Self->NS(),
156                   x('D:set',
157                        x('D:prop', @Properties),
158                   ),
159               ),
160           );
161
162           # { 'xmlns:C' => 'urn:ietf:params:xml:ns:caldav', 'xmlns:D' => 'DAV:' }
163
164   $Self->ns($key, $value)
165       Get or set namespace aliases, e.g
166
167         $Self->ns(C => 'urn:ietf:params:xml:ns:caldav');
168         my $NS_C = $Self->ns('C'); # urn:ietf:params:xml:ns:caldav
169
170   function2

AUTHOR

172       Bron Gondwana, "<brong at cpan.org>"
173

BUGS

175       Please report any bugs or feature requests to "bug-net-davtalk at
176       rt.cpan.org", or through the web interface at
177       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-DAVTalk>.  I will
178       be notified, and then you'll automatically be notified of progress on
179       your bug as I make changes.
180

SUPPORT

182       You can find documentation for this module with the perldoc command.
183
184           perldoc Net::DAVTalk
185
186       You can also look for information at:
187
188       ·   RT: CPAN's request tracker (report bugs here)
189
190           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-DAVTalk>
191
192       ·   AnnoCPAN: Annotated CPAN documentation
193
194           <http://annocpan.org/dist/Net-DAVTalk>
195
196       ·   CPAN Ratings
197
198           <http://cpanratings.perl.org/d/Net-DAVTalk>
199
200       ·   Search CPAN
201
202           <http://search.cpan.org/dist/Net-DAVTalk/>
203

ACKNOWLEDGEMENTS

206       Copyright 2015 FastMail Pty. Ltd.
207
208       This program is free software; you can redistribute it and/or modify it
209       under the terms of the the Artistic License (2.0). You may obtain a
210       copy of the full license at:
211
212       <http://www.perlfoundation.org/artistic_license_2_0>
213
214       Any use, modification, and distribution of the Standard or Modified
215       Versions is governed by this Artistic License. By using, modifying or
216       distributing the Package, you accept this license. Do not use, modify,
217       or distribute the Package, if you do not accept this license.
218
219       If your Modified Version has been derived from a Modified Version made
220       by someone other than you, you are nevertheless required to ensure that
221       your Modified Version complies with the requirements of this license.
222
223       This license does not grant you the right to use any trademark, service
224       mark, tradename, or logo of the Copyright Holder.
225
226       This license includes the non-exclusive, worldwide, free-of-charge
227       patent license to make, have made, use, offer to sell, sell, import and
228       otherwise transfer the Package with respect to any patent claims
229       licensable by the Copyright Holder that are necessarily infringed by
230       the Package. If you institute patent litigation (including a cross-
231       claim or counterclaim) against any party alleging that the Package
232       constitutes direct or contributory patent infringement, then this
233       Artistic License to you shall terminate on the date that such
234       litigation is filed.
235
236       Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
237       AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
238       THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
239       PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
240       YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
241       CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
242       CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
243       EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244
245
246
247perl v5.28.2                      2019-05-10                   Net::DAVTalk(3)
Impressum