1native::Core(3) User Contributed Perl Documentation native::Core(3)
2
3
4
6 SVN::Core - Core module of the subversion perl bindings
7
9 use SVN::Core; # does apr_initialize and cleanup for you
10
11 # create a root pool and set it as default pool for later use
12 my $pool = SVN::Pool->new_default;
13
14 sub something {
15 # create a subpool of the current default pool
16 my $pool = SVN::Pool->new_default_sub;
17 # some svn operations...
18
19 # $pool gets destroyed and the previous default pool
20 # is restored when $pool's lexical scope ends
21 }
22
23 # svn_stream_t as native perl io handle
24 my $stream = $txn->root->apply_text('trunk/filea', undef);
25 print $stream $text;
26 close $stream;
27
28 # native perl io handle as svn_stream_t
29 SVN::Repos::dump_fs($repos, \*STDOUT, \*STDERR,
30 0, $repos->fs->youngest_rev, 0);
31
33 SVN::Core implements higher level functions of fundamental subversion
34 functions.
35
37 SVN::Core::auth_open([auth provider array]);
38 Takes a reference to an array of authentication providers and
39 returns an auth_baton. If you use prompt providers you can not use
40 this function, but need to use the auth_open_helper.
41
42 SVN::Core::auth_open_helper([auth provider array);
43 Prompt providers return two values instead of one. The 2nd parame‐
44 ter is a reference to whatever was passed into them as the call‐
45 back. auth_open_helper splits up these arguments, passing the
46 provider objects into auth_open which gives it an auth_baton and
47 putting the other ones in an array. The first return value of this
48 function is the auth_baton, the second is a reference to an array
49 containing the references to the callbacks.
50
51 These callback arrays should be stored in the object the auth_baton
52 is attached to.
53
55 svn_stream_t - SVN::Stream
56
57 You can use native perl io handles (including io globs) as svn_stream_t
58 in subversion functions. Returned svn_stream_t are also translated into
59 perl io handles, so you could access them with regular print, read,
60 etc.
61
62 Note that some functions take a stream to read or write, while it does
63 not close it but still hold the reference to the handle. In this case
64 the handle won't be destroyed properly. You should always use correct
65 default pool before calling such functions.
66
67 svn_pool_t - SVN::Pool
68
69 The perl bindings significantly simplify the usage of pools, while
70 still being manually adjustable.
71
72 Functions requiring pool as the last argument (which are, almost all of
73 the subversion functions), the pool is optionally. The default pool is
74 used if it is omitted. If default pool is not set, a new root pool will
75 be created and set as default automatically when the first function
76 requiring a default pool is called.
77
78 For callback functions providing pool to your subroutine, you could
79 also use $pool->default to make it the default pool in the scope.
80
81 Methods
82
83 new ([$parent])
84 Create a new pool. The pool is a root pool if $parent is not sup‐
85 plied.
86
87 new_default ([$parent])
88 Create a new pool. The pool is a root pool if $parent is not sup‐
89 plied. Set the new pool as default pool.
90
91 new_default_sub
92 Create a new subpool of the current default pool, and set the
93 resulting pool as new default pool.
94
95 clear
96 Clear the pool.
97
98 destroy
99 Destroy the pool. If the pool is the default pool, restore the pre‐
100 vious default pool as default. This is normally called automati‐
101 cally when the SVN::Pool object is no longer used and destroyed by
102 the perl garbage collector.
103
104 svn_error_t - SVN::Error
105
106 By default the perl bindings handle exceptions for you. The default
107 handler automatically croaks with an appropriate error message. This
108 is likely sufficient for simple scripts, but more complex usage may
109 demand handling of errors.
110
111 You can override the default exception handler by changing the
112 $SVN::Error::handler variable. This variable holds a reference to a
113 perl sub that should be called whenever an error is returned by a svn
114 function. This sub will be passed a svn_error_t object. Its return
115 value is ignored.
116
117 If you set the $SVN::Error::handler to undef then each call will return
118 an svn_error_t object as its first return in the case of an error, fol‐
119 lowed by the normal return values. If there is no error then a
120 svn_error_t will not be returned and only the normal return values will
121 be returned. When using this mode you should be careful only to call
122 functions in array context. For example: my ($ci) =
123 $ctx->mkdir('http://svn/foo'); In this case $ci will be an svn_error_t
124 object if an error occurs and a svn_client_commit_info object other‐
125 wise. If you leave the parenthesis off around $ci (scalar context) it
126 will be the commit_info object, which in the case of an error will be
127 undef.
128
129 If you plan on using this exception handling, understanding the excep‐
130 tion handling system the C API uses is helpful. You can find informa‐
131 tion on it in the HACKING file and the API documentation. Looking at
132 the implementation of SVN::Error::croak_on_error and
133 SVN::Error::expanded_message may be helpful as well.
134
135 $svn_error_t->apr_err()
136 APR error value, possibly SVN_ custom error.
137
138 $svn_error_t->message()
139 Details from producer of error.
140
141 $svn_error_t->child()
142 svn_error_t object of the error that's wrapped.
143
144 $svn_error_t->pool()
145 The pool holding this error and any child errors it wraps.
146
147 $svn_error_t->file()
148 Source file where the error originated.
149
150 $svn_error_t->line()
151 Source line where the error originated.
152
153 SVN::Error::strerror($apr_status_t)
154 Returns the english description of the status code.
155
156 $svn_error_t->strerror()
157 Returns the english description of the apr_err status code set on
158 the $svn_error_t. This is short for: SVN::Error::str‐
159 error($svn_error_t->apr_err());
160
161 SVN::Error::create($apr_err, $child, $message);
162 Returns a new svn_error_t object with the error status specified in
163 $apr_err, the child as $child, and error message of $message.
164
165 SVN::Error::quick_wrap($child, $new_msg); or
166 $child->quick_wrap($new_msg);
167 A quick n' easy way to create a wrappered exception with your own
168 message before throwing it up the stack.
169
170 $child is the svn_error_t object you want to wrap and $new_msg is
171 the new error string you want to set.
172
173 SVN::Error::compose($chain, $new_error); or $chain->com‐
174 pose($new_error);
175 Add new_err to the end of $chain's chain of errors.
176
177 The $new_err chain will be copied into $chain's pool and destroyed,
178 so $new_err itself becomes invalid after this function.
179
180 SVN::Error::clear($svn_error_t); or $svn_error_t->clear();
181 Free the memory used by $svn_error_t, as well as all ancestors and
182 descendants of $svn_error_t.
183
184 You must call this on every svn_error_t object you get or you will
185 leak memory.
186
187 SVN::Error::expanded_message($svn_error_t) or
188 $svn_error_t->expanded_message()
189 Returns the error message by tracing through the svn_error_t object
190 and its children and concatenating the error messages. This is how
191 the internal exception handlers get their error messages.
192
193 SVN::Error::is_error($value)
194 Returns true if the value is an svn_error type return. Returns
195 false if the value is anything else or undefined. This is useful
196 for seeing if a call has returned an error.
197
198 SVN::Error::croak_on_error
199 Default error handler. It takes an svn_error_t and extracts the
200 error messages from it and croaks with those messages.
201
202 It can be used two ways. The first is detailed above as setting it
203 as the automatic exception handler via setting $SVN::Error::han‐
204 dler.
205
206 The 2nd is if you have $SVN::Error::handler set to undef as a wrap‐
207 per for calls you want to croak on when there is an error but don't
208 want to have to write an explicit error handler for example:
209
210 my $result_rev=SVN::Error::croak_on_error($ctx->check‐
211 out($url,$path,'HEAD',1));
212
213 If there is no error then croak_on_error will return the arguments
214 passed to it unchanged.
215
216 SVN::Error::confess_on_error
217 The same as croak_on_error except it will give a more detailed
218 stack backtrace. Including showing internal calls within the
219 implementations of the perl bindings. This is useful if you're
220 working on developing the bindings.
221
222 SVN::Error::ignore_error
223 This is useful for wrapping around calls which you wish to ignore
224 any potential error. It checks to see if the first parameter is an
225 error and if it is it clears it. It then returns all the other
226 parameters.
227
228 svn_log_changed_path_t
229
230 $lcp->action()
231 'A'dd, 'D'elete, 'R'eplace, 'M'odify
232
233 $lcp->copyfrom_path()
234 Source path of copy (if any).
235
236 $lcp->copyfrom_rev()
237 Source revision of copy (if any).
238
239 svn_node_kind_t - SVN::Node
240
241 An enum of the following constants:
242
243 $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir,
244 $SVN::Node::unknown.
245
246 svn_opt_revision_t
247
248 svn_config_t
249
250 Opaque object describing a set of configuration options.
251
252 svn_dirent_t
253
254 $dirent->kind()
255 Node kind. One of these constants: $SVN::Node::none,
256 $SVN::Node::file, $SVN::Node::dir, $SVN::Node::unknown.
257
258 $dirent->size()
259 Length of file text, or 0 for directories.
260
261 $dirent->has_props()
262 Does the node have props?
263
264 $dirent->created_rev()
265 Last rev in which this node changed.
266
267 $dirent->time()
268 Time of created_rev (mod-time).
269
270 $dirent->last_author()
271 Author of created rev.
272
273 svn_auth_cred_simple_t
274
275 $simple->username()
276 Username.
277
278 $simple->password()
279 Password.
280
281 $simple->may_save()
282 Indicates if the credentials may be saved (to disk).
283
284 svn_auth_cred_username_t
285
286 $username->username()
287 Username.
288
289 $username->may_save()
290 Indicates if the credentials may be saved (to disk).
291
292 svn_auth_cred_ssl_server_trust_t
293
294 $strust->may_save()
295 Indicates if the credentials may be saved (to disk).
296
297 $strust->accepted_failures()
298 Bit mask of the accepted failures.
299
300 svn_auth_ssl_server_cert_info_t
301
302 $scert->hostname()
303 Primary CN.
304
305 $scert->fingerprint()
306 ASCII fingerprint.
307
308 $scert->valid_from()
309 ASCII date from which the certificate is valid.
310
311 $scert->valid_until()
312 ASCII date until which the certificate is valid.
313
314 $scert->issuer_dname()
315 DN of the certificate issuer.
316
317 $scert->ascii_cert()
318 Base-64 encoded DER certificate representation.
319
320 svn_auth_cred_ssl_client_cert_t
321
322 $ccert->cert_file()
323 Full paths to the certificate file.
324
325 $ccert->may_save()
326 Indicates if the credentials may be saved (to disk).
327
328 svn_auth_cred_ssl_client_cert_pw_t
329
330 $ccertpw->password()
331 Certificate password.
332
333 $ccertpw->may_save()
334 Indicates if the credentials may be saved (to disk).
335
337 SVN::Auth::SSL
338
339 $SVN::Auth::SSL::NOTYETVALID
340 Certificate is not yet valid.
341
342 $SVN::Auth::SSL::EXPIRED
343 Certificate has expired.
344
345 $SVN::Auth::SSL::CNMISMATCH
346 Certificate's CN (hostname) does not match the remote hostname.
347
348 $SVN::Auth::SSL::UNKNOWNCA
349 Certificate authority is unknown (i.e. not trusted).
350
351 $SVN::Auth::SSL::OTHER
352 Other failure. This can happen if neon has introduced a new failure
353 bit that we do not handle yet.
354
356 Chia-liang Kao <clkao@clkao.org>
357
359 Copyright (c) 2003 CollabNet. All rights reserved.
360
361 This software is licensed as described in the file COPYING, which you
362 should have received as part of this distribution. The terms are also
363 available at http://subversion.tigris.org/license-1.html. If newer
364 versions of this license are posted there, you may use a newer version
365 instead, at your option.
366
367 This software consists of voluntary contributions made by many individ‐
368 uals. For exact contribution history, see the revision history and
369 logs, available at http://subversion.tigris.org/.
370
371
372
373perl v5.8.8 2005-06-17 native::Core(3)