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
209 $result_rev=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_node_kind_t - SVN::Node
239 An enum of the following constants:
240
241 $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir,
242 $SVN::Node::unknown.
243
244 svn_opt_revision_t
245 svn_config_t
246 Opaque object describing a set of configuration options.
247
248 svn_dirent_t
249 $dirent->kind()
250 Node kind. A number which matches one of these constants:
251 $SVN::Node::none, $SVN::Node::file, $SVN::Node::dir,
252 $SVN::Node::unknown.
253
254 $dirent->size()
255 Length of file text, or 0 for directories.
256
257 $dirent->has_props()
258 Does the node have properties?
259
260 $dirent->created_rev()
261 Last revision in which this node changed.
262
263 $dirent->time()
264 Time of created_rev (mod-time).
265
266 $dirent->last_author()
267 Author of created rev.
268
269 svn_auth_cred_simple_t
270 $simple->username()
271 Username.
272
273 $simple->password()
274 Password.
275
276 $simple->may_save()
277 Indicates if the credentials may be saved (to disk).
278
279 svn_auth_cred_username_t
280 $username->username()
281 Username.
282
283 $username->may_save()
284 Indicates if the credentials may be saved (to disk).
285
286 svn_auth_cred_ssl_server_trust_t
287 $strust->may_save()
288 Indicates if the credentials may be saved (to disk).
289
290 $strust->accepted_failures()
291 Bit mask of the accepted failures.
292
293 svn_auth_ssl_server_cert_info_t
294 $scert->hostname()
295 Primary CN.
296
297 $scert->fingerprint()
298 ASCII fingerprint.
299
300 $scert->valid_from()
301 ASCII date from which the certificate is valid.
302
303 $scert->valid_until()
304 ASCII date until which the certificate is valid.
305
306 $scert->issuer_dname()
307 DN of the certificate issuer.
308
309 $scert->ascii_cert()
310 Base-64 encoded DER certificate representation.
311
312 svn_auth_cred_ssl_client_cert_t
313 $ccert->cert_file()
314 Full paths to the certificate file.
315
316 $ccert->may_save()
317 Indicates if the credentials may be saved (to disk).
318
319 svn_auth_cred_ssl_client_cert_pw_t
320 $ccertpw->password()
321 Certificate password.
322
323 $ccertpw->may_save()
324 Indicates if the credentials may be saved (to disk).
325
327 SVN::Auth::SSL
328 $SVN::Auth::SSL::NOTYETVALID
329 Certificate is not yet valid.
330
331 $SVN::Auth::SSL::EXPIRED
332 Certificate has expired.
333
334 $SVN::Auth::SSL::CNMISMATCH
335 Certificate's CN (hostname) does not match the remote hostname.
336
337 $SVN::Auth::SSL::UNKNOWNCA
338 Certificate authority is unknown (i.e. not trusted).
339
340 $SVN::Auth::SSL::OTHER
341 Other failure. This can happen if neon has introduced a new failure
342 bit that we do not handle yet.
343
344 _p_svn_lock_t
345 Objects of this class contain information about locks placed on files
346 in a repository. It has the following accessor methods:
347
348 path
349 The full path to the file which is locked, starting with a forward
350 slash ("/").
351
352 token
353 A string containing the lock token, which is a unique URI.
354
355 owner
356 The username of whoever owns the lock.
357
358 comment
359 A comment associated with the lock, or undef if there isn't one.
360
361 is_dav_comment
362 True if the comment was made by a generic DAV client.
363
364 creation_date
365 Time at which the lock was created, as the number of microseconds
366 since 00:00:00 January 1, 1970 UTC. Divide it by 1_000_000 to get
367 a Unix time_t value.
368
369 expiration_date
370 When the lock will expire. Has the value '0' if the lock will
371 never expire.
372
374 Chia-liang Kao <clkao@clkao.org>
375
377 Licensed to the Apache Software Foundation (ASF) under one
378 or more contributor license agreements. See the NOTICE file
379 distributed with this work for additional information
380 regarding copyright ownership. The ASF licenses this file
381 to you under the Apache License, Version 2.0 (the
382 "License"); you may not use this file except in compliance
383 with the License. You may obtain a copy of the License at
384
385 http://www.apache.org/licenses/LICENSE-2.0
386
387 Unless required by applicable law or agreed to in writing,
388 software distributed under the License is distributed on an
389 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
390 KIND, either express or implied. See the License for the
391 specific language governing permissions and limitations
392 under the License.
393
394
395
396perl v5.16.3 2011-07-16 native::Core(3)