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
44 parameter is a reference to whatever was passed into them as the
45 callback. 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 You can use native perl io handles (including io globs) as svn_stream_t
57 in subversion functions. Returned svn_stream_t are also translated into
58 perl io handles, so you could access them with regular print, read,
59 etc.
60
61 Note that some functions take a stream to read from or write to, but do
62 not close the stream while still holding the reference to the io
63 handle. In this case the handle won't be destroyed properly. You
64 should always set up the correct default pool before calling such
65 functions.
66
67 svn_pool_t - SVN::Pool
68 The perl bindings significantly simplify the usage of pools, while
69 still being manually adjustable.
70
71 For functions requiring a pool as the last argument (which are, almost
72 all of the subversion functions), the pool argument is optional. The
73 default pool is used if it is omitted. When "SVN::Core" is loaded, it
74 creates a new default pool, which is also available from
75 "SVN::Core->gpool".
76
77 For callback functions providing a pool to your subroutine, you could
78 also use $pool->default to make it the default pool in the scope.
79
80 Methods
81
82 new([$parent])
83 Create a new pool. The pool is a root pool if $parent is not
84 supplied.
85
86 new_default([$parent])
87 Create a new pool. The pool is a root pool if $parent is not
88 supplied. Set the new pool as default pool.
89
90 new_default_sub
91 Create a new subpool of the current default pool, and set the
92 resulting pool as new default pool.
93
94 clear
95 Clear the pool.
96
97 DESTROY
98 Destroy the pool. If the pool was the default pool, restore the
99 previous default pool. This is normally called automatically when
100 the SVN::Pool object is no longer used and destroyed by the perl
101 garbage collector.
102
103 svn_error_t - SVN::Error
104 By default the perl bindings handle exceptions for you. The default
105 handler automatically croaks with an appropriate error message. This
106 is likely sufficient for simple scripts, but more complex usage may
107 demand handling of errors.
108
109 You can override the default exception handler by changing the
110 $SVN::Error::handler variable. This variable holds a reference to a
111 perl sub that should be called whenever an error is returned by a svn
112 function. This sub will be passed a svn_error_t object. Its return
113 value is ignored.
114
115 If you set the $SVN::Error::handler to undef then each call will return
116 an svn_error_t object as its first return in the case of an error,
117 followed by the normal return values. If there is no error then a
118 svn_error_t will not be returned and only the normal return values will
119 be returned. When using this mode you should be careful only to call
120 functions in array context. For example: my ($ci) =
121 $ctx->mkdir('http://svn/foo'); In this case $ci will be an svn_error_t
122 object if an error occurs and a svn_client_commit_info object
123 otherwise. If you leave the parenthesis off around $ci (scalar
124 context) it will be the commit_info object, which in the case of an
125 error will be undef.
126
127 If you plan on using explicit exception handling, understanding the
128 exception handling system the C API uses is helpful. You can find
129 information on it in the HACKING file and the API documentation.
130 Looking at the implementation of SVN::Error::croak_on_error and
131 SVN::Error::expanded_message may be helpful as well.
132
133 $svn_error_t->apr_err()
134 APR error value, possibly SVN_ custom error.
135
136 $svn_error_t->message()
137 Details from producer of error.
138
139 $svn_error_t->child()
140 svn_error_t object of the error that's wrapped.
141
142 $svn_error_t->pool()
143 The pool holding this error and any child errors it wraps.
144
145 $svn_error_t->file()
146 Source file where the error originated.
147
148 $svn_error_t->line()
149 Source line where the error originated.
150
151 SVN::Error::strerror($apr_status_t)
152 Returns the english description of the status code.
153
154 $svn_error_t->strerror()
155 Returns the english description of the apr_err status code set on
156 the $svn_error_t. This is short for:
157 SVN::Error::strerror($svn_error_t->apr_err());
158
159 SVN::Error::create($apr_err, $child, $message);
160 Returns a new svn_error_t object with the error status specified in
161 $apr_err, the child as $child, and error message of $message.
162
163 SVN::Error::quick_wrap($child, $new_msg); or
164 $child->quick_wrap($new_msg);
165 A quick n' easy way to create a wrappered exception with your own
166 message before throwing it up the stack.
167
168 $child is the svn_error_t object you want to wrap and $new_msg is
169 the new error string you want to set.
170
171 SVN::Error::compose($chain, $new_error); or
172 $chain->compose($new_error);
173 Add new_err to the end of $chain's chain of errors.
174
175 The $new_err chain will be copied into $chain's pool and destroyed,
176 so $new_err itself becomes invalid after this function.
177
178 SVN::Error::clear($svn_error_t); or $svn_error_t->clear();
179 Free the memory used by $svn_error_t, as well as all ancestors and
180 descendants of $svn_error_t.
181
182 You must call this on every svn_error_t object you get or you will
183 leak memory.
184
185 SVN::Error::expanded_message($svn_error_t) or
186 $svn_error_t->expanded_message()
187 Returns the error message by tracing through the svn_error_t object
188 and its children and concatenating the error messages. This is how
189 the internal exception handlers get their error messages.
190
191 SVN::Error::is_error($value)
192 Returns true if value is of type svn_error. Returns false if value
193 is anything else or undefined. This is useful for seeing if a call
194 has returned an error.
195
196 SVN::Error::croak_on_error
197 Default error handler. It takes an svn_error_t and extracts the
198 error messages from it and croaks with those messages.
199
200 It can be used in two ways. The first is detailed above as setting
201 it as the automatic exception handler via setting
202 $SVN::Error::handler.
203
204 The second is if you have $SVN::Error::handler set to undef as a
205 wrapper for calls you want to croak on when there is an error, but
206 you don't want to write an explicit error handler. For example:
207
208 my $rev =
209 SVN::Error::croak_on_error($ctx->checkout($url,$path,'HEAD',1));
210
211 If there is no error then croak_on_error will return the arguments
212 passed to it unchanged.
213
214 SVN::Error::confess_on_error
215 The same as croak_on_error except it will give a more detailed
216 stack backtrace, including internal calls within the implementation
217 of the perl bindings. This is useful when you are doing
218 development work on the bindings themselves.
219
220 SVN::Error::ignore_error
221 This is useful for wrapping around calls which you wish to ignore
222 any potential error. It checks to see if the first parameter is an
223 error and if it is it clears it. It then returns all the other
224 parameters.
225
226 svn_log_changed_path_t
227 $lcp->action()
228 'A'dd, 'D'elete, 'R'eplace, 'M'odify
229
230 $lcp->copyfrom_path()
231 Source path of copy, or "undef" if there isn't any previous
232 revision history.
233
234 $lcp->copyfrom_rev()
235 Source revision of copy, or $SVN::Core::INVALID_REVNUM if there is
236 no previous history.
237
238 svn_log_changed_path2_t
239 An object to represent a path that changed for a log entry.
240
241 $lcp->action()
242 'A'dd, 'D'elete, 'R'eplace, 'M'odify
243
244 $lcp->copyfrom_path()
245 Source path of copy, or "undef" if there isn't any previous
246 revision history.
247
248 $lcp->copyfrom_rev()
249 Source revision of copy, or $SVN::Core::INVALID_REVNUM if there is
250 no previous history.
251
252 $lcp->node_kind()
253 The type of the node, a $SVN::Node enum; may be
254 $SVN::Node::unknown.
255
256 $lcp->text_modified()
257 Is the text modified, a "SVN::Tristate" enum, may be
258 $SVN::Tristate::unknown.
259
260 $lcp->props_modified()
261 Are properties modified, a "SVN::Tristate" enum, may be
262 $SVN::Tristate::unknown.
263
264 svn_node_kind_t - SVN::Node
265 An enum of the following constants:
266
267 $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir,
268 $SVN::Node::unknown.
269
270 svn_tristate_t - SVN::Tristate
271 An enum of the following constants:
272
273 $SVN::Tristate::true, $SVN::Tristate::false, $SVN::Tristate::unknown
274
275 Note that these true/false values have nothing to do with Perl's
276 concept of truth. In fact, each constant would evaluate to true in a
277 boolean context.
278
279 svn_depth_t - SVN::Depth
280 An enum of the following constants:
281
282 $SVN::Depth::unknown
283 Depth undetermined or ignored. In some contexts, this means the
284 client should choose an appropriate default depth. The server will
285 generally treat it as $SVN::Depth::infinity.
286
287 $SVN::Depth::exclude
288 Exclude (i.e., don't descend into) directory D.
289
290 Note: In Subversion 1.5, $SVN::Depth::exclude is not supported
291 anyhwere in the client-side (Wc/Client/etc) code; it is only
292 supported as an argument to set_path functions in the Ra and Repos
293 reporters. (This will enable future versions of Subversion to run
294 updates, etc, against 1.5 servers with proper $SVN::Depth::exclude
295 behavior, once we get a chance to implement client side support for
296 $SVN::Depth::exclude).
297
298 $SVN::Depth::empty
299 Just the named directory D, no entries.
300
301 Updates will not pull in any files or subdirectories not already
302 present.
303
304 $SVN::Depth::files
305 D + its files children, but not subdirs.
306
307 Updates will pull in any files not already present, but not
308 subdirectories.
309
310 $SVN::Depth::immediates
311 D + immediate children (D and its entries).
312
313 Updates will pull in any files or subdirectories not already
314 present; those subdirectories' this_dir entries will have depth-
315 empty.
316
317 $SVN::Depth::infinity
318 D + all descendants (full recursion from D).
319
320 Updates will pull in any files or subdirectories not already
321 present; those subdirectories' this_dir entries will have depth-
322 infinity. Equivalent to the pre 1.5 default update behavior.
323
324 svn_opt_revision_t
325 A revision, specified in one of "SVN::Core::opt_revision_*" ways.
326
327 $rev->kind()
328 An enum denoting how the revision $rev was specified. One of
329 $SVN::Core::opt_revision_unspecified,
330 $SVN::Core::opt_revision_number, $SVN::Core::opt_revision_date,
331 $SVN::Core::opt_revision_committed,
332 $SVN::Core::opt_revision_previous, $SVN::Core::opt_revision_base,
333 $SVN::Core::opt_revision_working or $SVN::Core::opt_revision_head.
334
335 $rev->value()
336 Extra data about the revision. Only relevant if "$rev->kind" is
337 $SVN::Core::opt_revision_number (where it contains the revision
338 number) or $SVN::Core::opt_revision_date (where it contains a
339 date).
340
341 svn_opt_revision_range_t
342 An object representing a range of revisions.
343
344 $range->start()
345 The first revision in the range, a "_p_svn_opt_revision_t" object.
346
347 $range->end()
348 The last revision in the range, a "_p_svn_opt_revision_t" object.
349
350 svn_config_t
351 Opaque object describing a set of configuration options.
352
353 svn_dirent_t
354 $dirent->kind()
355 Node kind. A number which matches one of these constants:
356 $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir,
357 $SVN::Node::unknown.
358
359 $dirent->size()
360 Length of file text, or 0 for directories.
361
362 $dirent->has_props()
363 Does the node have properties?
364
365 $dirent->created_rev()
366 Last revision in which this node changed.
367
368 $dirent->time()
369 Time of created_rev (mod-time).
370
371 $dirent->last_author()
372 Author of created rev.
373
374 svn_commit_info_t
375 $commit->revision()
376 Just committed revision.
377
378 $commit->date()
379 Server-side date of the commit.
380
381 $commit->author()
382 Author of the commit.
383
384 $commit->post_commit_err()
385 Error message from the post-commit hook, or undef.
386
387 $commit->repos_root()
388 Repository root, may be "undef" if unknown.
389
390 svn_log_entry_t
391 $entry->revision()
392 The revision of the commit.
393
394 $entry->revprops()
395 A reference to a hash of requested revision properties, which may
396 be "undef" if it would contain no revprops.
397
398 $entry->has_children()
399 Whether or not this message has children.
400
401 $entry->changed_paths2()
402 A reference to hash containing as keys every path committed in
403 "$entry->revision()"; the values are "_p_svn_log_changed_path2_t"
404 objects.
405
406 $entry->non_inheritable()
407 Whether "$entry->revision()" should be interpreted as non-
408 inheritable in the same sense of "_p_svn_merge_range_t".
409
410 $entry->subtractive_merge()
411 Whether "$entry->revision()" is a merged revision resulting from a
412 reverse merge.
413
414 svn_auth_cred_simple_t
415 $simple->username()
416 Username.
417
418 $simple->password()
419 Password.
420
421 $simple->may_save()
422 Indicates if the credentials may be saved (to disk).
423
424 svn_auth_cred_username_t
425 $username->username()
426 Username.
427
428 $username->may_save()
429 Indicates if the credentials may be saved (to disk).
430
431 svn_auth_cred_ssl_server_trust_t
432 $strust->may_save()
433 Indicates if the credentials may be saved (to disk).
434
435 $strust->accepted_failures()
436 Bit mask of the accepted failures.
437
438 svn_auth_ssl_server_cert_info_t
439 $scert->hostname()
440 Primary CN.
441
442 $scert->fingerprint()
443 ASCII fingerprint.
444
445 $scert->valid_from()
446 ASCII date from which the certificate is valid.
447
448 $scert->valid_until()
449 ASCII date until which the certificate is valid.
450
451 $scert->issuer_dname()
452 DN of the certificate issuer.
453
454 $scert->ascii_cert()
455 Base-64 encoded DER certificate representation.
456
457 svn_auth_cred_ssl_client_cert_t
458 $ccert->cert_file()
459 Full paths to the certificate file.
460
461 $ccert->may_save()
462 Indicates if the credentials may be saved (to disk).
463
464 svn_auth_cred_ssl_client_cert_pw_t
465 $ccertpw->password()
466 Certificate password.
467
468 $ccertpw->may_save()
469 Indicates if the credentials may be saved (to disk).
470
472 SVN::Auth::SSL
473 $SVN::Auth::SSL::NOTYETVALID
474 Certificate is not yet valid.
475
476 $SVN::Auth::SSL::EXPIRED
477 Certificate has expired.
478
479 $SVN::Auth::SSL::CNMISMATCH
480 Certificate's CN (hostname) does not match the remote hostname.
481
482 $SVN::Auth::SSL::UNKNOWNCA
483 Certificate authority is unknown (i.e. not trusted).
484
485 $SVN::Auth::SSL::OTHER
486 Other failure. This can happen if some unknown error condition
487 occurs.
488
489 _p_svn_lock_t
490 Objects of this class contain information about locks placed on files
491 in a repository. It has the following accessor methods:
492
493 path
494 The full path to the file which is locked, starting with a forward
495 slash ("/").
496
497 token
498 A string containing the lock token, which is a unique URI.
499
500 owner
501 The username of whoever owns the lock.
502
503 comment
504 A comment associated with the lock, or undef if there isn't one.
505
506 is_dav_comment
507 True if the comment was made by a generic DAV client.
508
509 creation_date
510 Time at which the lock was created, as the number of microseconds
511 since 00:00:00 January 1, 1970 UTC. Divide it by 1_000_000 to get
512 a Unix time_t value.
513
514 expiration_date
515 When the lock will expire. Has the value '0' if the lock will
516 never expire.
517
519 Chia-liang Kao <clkao@clkao.org>
520
522 Licensed to the Apache Software Foundation (ASF) under one
523 or more contributor license agreements. See the NOTICE file
524 distributed with this work for additional information
525 regarding copyright ownership. The ASF licenses this file
526 to you under the Apache License, Version 2.0 (the
527 "License"); you may not use this file except in compliance
528 with the License. You may obtain a copy of the License at
529
530 http://www.apache.org/licenses/LICENSE-2.0
531
532 Unless required by applicable law or agreed to in writing,
533 software distributed under the License is distributed on an
534 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
535 KIND, either express or implied. See the License for the
536 specific language governing permissions and limitations
537 under the License.
538
539
540
541perl v5.34.1 2022-07-05 native::Core(3)