# perldoc > SVN::Core

---
type: CommandReference
command: SVN::Core
mode: perldoc
section: 3
source: perldoc
---

## Quick Reference
- `use SVN::Core;` — initialize APR and set up default pool
- `my $pool = SVN::Pool->new_default;` — create and set default pool
- `my $pool = SVN::Pool->new_default_sub;` — create subpool of current default
- `my $stream = $txn->root->apply_text('trunk/filea', undef); print $stream $text; close $stream;` — write to svn_stream_t as native IO handle
- `SVN::Repos::dump_fs($repos, \*STDOUT, \*STDERR, 0, $repos->fs->youngest_rev, 0);` — use native IO handle as svn_stream_t
- `$SVN::Error::handler = \&my_handler;` — override default error handler
- `$SVN::Error::handler = undef;` — return svn_error_t objects directly
- `SVN::Error::croak_on_error($result);` — wrap call to croak on error

## Name
SVN::Core — Core module of the subversion perl bindings

## Synopsis
perl
use SVN::Core; # does apr_initialize and cleanup

my $pool = SVN::Pool->new_default;

sub something {
    my $pool = SVN::Pool->new_default_sub;
    # svn operations...
    # $pool destroyed and previous default restored when scope ends
}

# svn_stream_t as native perl IO handle
my $stream = $txn->root->apply_text('trunk/filea', undef);
print $stream $text;
close $stream;

# native perl IO handle as svn_stream_t
SVN::Repos::dump_fs($repos, \*STDOUT, \*STDERR,
                    0, $repos->fs->youngest_rev, 0);
## Functions
- `SVN::Core::auth_open([auth provider array])` — returns auth_baton from array of auth providers. Cannot use prompt providers.
- `SVN::Core::auth_open_helper([auth provider array])` — splits prompt provider callbacks, returns (auth_baton, \@callbacks). Callbacks should be stored in the object holding the auth_baton.

## Other Objects

### svn_stream_t — SVN::Stream
Native perl IO handles (including IO globs) can be used as svn_stream_t. Returned svn_stream_t are translated to perl IO handles (print, read, etc.). Set correct default pool before calling functions that hold a stream reference without closing.

### svn_pool_t — SVN::Pool
Pool argument is optional; uses default pool if omitted. `SVN::Core->gpool` provides the default pool. Methods:
- `new([$parent])` — create pool (root if no parent)
- `new_default([$parent])` — create and set as default pool
- `new_default_sub()` — create subpool of current default and set as new default
- `clear()` — clear the pool
- `DESTROY` — destroy pool; restores previous default if current default. Called automatically by garbage collector.

### svn_error_t — SVN::Error
Default handler croaks with error message. Override by setting `$SVN::Error::handler` to a sub reference, or `undef` to return svn_error_t objects directly (must use array context). Methods:
- `$e->apr_err()` — APR error value
- `$e->message()` — error details
- `$e->child()` — wrapped error object
- `$e->pool()` — pool holding error
- `$e->file()` — source file
- `$e->line()` — source line
- `SVN::Error::strerror($apr_status)` — English description of status code
- `$e->strerror()` — shortcut for `SVN::Error::strerror($e->apr_err())`
- `SVN::Error::create($apr_err, $child, $message)` — create new error object
- `SVN::Error::quick_wrap($child, $new_msg)` — wrap error with message
- `SVN::Error::compose($chain, $new_error)` — append `$new_error` to `$chain`
- `SVN::Error::clear($e)` — free memory of error and all ancestors/descendants (must call to avoid leaks)
- `SVN::Error::expanded_message($e)` — trace through children and concatenate messages
- `SVN::Error::is_error($value)` — true if value is svn_error type
- `SVN::Error::croak_on_error` — default handler; croaks with error messages. Also usable as wrapper: `my $rev = SVN::Error::croak_on_error($ctx->checkout(...))`
- `SVN::Error::confess_on_error` — like croak_on_error but with detailed stack trace
- `SVN::Error::ignore_error` — clears error if first param is an error, returns remaining params

### svn_log_changed_path_t
- `$lcp->action()` — 'A', 'D', 'R', 'M'
- `$lcp->copyfrom_path()` — source path or `undef`
- `$lcp->copyfrom_rev()` — source revision or `$SVN::Core::INVALID_REVNUM`

### svn_log_changed_path2_t
Same as above plus:
- `$lcp->node_kind()` — `SVN::Node` enum
- `$lcp->text_modified()` — `SVN::Tristate` enum
- `$lcp->props_modified()` — `SVN::Tristate` enum

### svn_node_kind_t — SVN::Node
Constants: `$SVN::Node::none`, `$SVN::Node::file`, `$SVN::Node::dir`, `$SVN::Node::unknown`

### svn_tristate_t — SVN::Tristate
Constants: `$SVN::Tristate::true`, `$SVN::Tristate::false`, `$SVN::Tristate::unknown`

### svn_depth_t — SVN::Depth
Constants:
- `$SVN::Depth::unknown` — depth undetermined; defaults to infinity on server
- `$SVN::Depth::exclude` — exclude directory D (not supported in client-side 1.5)
- `$SVN::Depth::empty` — just the directory, no entries
- `$SVN::Depth::files` — directory + file children
- `$SVN::Depth::immediates` — directory + immediate children
- `$SVN::Depth::infinity` — full recursion (pre-1.5 default)

### svn_opt_revision_t
- `$rev->kind()` — enum: `$SVN::Core::opt_revision_unspecified`, `_number`, `_date`, `_committed`, `_previous`, `_base`, `_working`, `_head`
- `$rev->value()` — revision number (if kind `_number`) or date (if `_date`)

### svn_opt_revision_range_t
- `$range->start()` — first revision (`_p_svn_opt_revision_t`)
- `$range->end()` — last revision (`_p_svn_opt_revision_t`)

### svn_config_t
Opaque object for configuration options.

### svn_dirent_t
- `$d->kind()` — `SVN::Node` constant
- `$d->size()` — file length (0 for dirs)
- `$d->has_props()` — boolean
- `$d->created_rev()` — last change revision
- `$d->time()` — mod-time of created_rev
- `$d->last_author()` — author of created rev

### svn_commit_info_t
- `$c->revision()` — committed revision
- `$c->date()` — server-side commit date
- `$c->author()` — commit author
- `$c->post_commit_err()` — post-commit hook error or `undef`
- `$c->repos_root()` — repository root or `undef`

### svn_log_entry_t
- `$e->revision()` — commit revision
- `$e->revprops()` — hash reference of revprops, may be `undef`
- `$e->has_children()` — boolean
- `$e->changed_paths2()` — hash of `_p_svn_log_changed_path2_t` objects keyed by path
- `$e->non_inheritable()` — boolean
- `$e->subtractive_merge()` — boolean

### svn_auth_cred_simple_t
- `$c->username()`, `$c->password()`, `$c->may_save()`

### svn_auth_cred_username_t
- `$c->username()`, `$c->may_save()`

### svn_auth_cred_ssl_server_trust_t
- `$c->may_save()`, `$c->accepted_failures()`

### svn_auth_ssl_server_cert_info_t
- `$c->hostname()`, `$c->fingerprint()`, `$c->valid_from()`, `$c->valid_until()`, `$c->issuer_dname()`, `$c->ascii_cert()`

### svn_auth_cred_ssl_client_cert_t
- `$c->cert_file()`, `$c->may_save()`

### svn_auth_cred_ssl_client_cert_pw_t
- `$c->password()`, `$c->may_save()`

### _p_svn_lock_t
- `path` — full path from root
- `token` — unique lock URI
- `owner` — username
- `comment` — comment or `undef`
- `is_dav_comment` — boolean
- `creation_date` — microseconds since epoch
- `expiration_date` — 0 if never expires

## Constants
### SVN::Auth::SSL
- `$SVN::Auth::SSL::NOTYETVALID`
- `$SVN::Auth::SSL::EXPIRED`
- `$SVN::Auth::SSL::CNMISMATCH`
- `$SVN::Auth::SSL::UNKNOWNCA`
- `$SVN::Auth::SSL::OTHER`

## See Also
- [SVN::Pool](https://metacpan.org/pod/SVN::Pool)
- [SVN::Stream](https://metacpan.org/pod/SVN::Stream)
- [SVN::Error](https://metacpan.org/pod/SVN::Error)
- [SVN::Node](https://metacpan.org/pod/SVN::Node)
- [SVN::Tristate](https://metacpan.org/pod/SVN::Tristate)
- [SVN::Depth](https://metacpan.org/pod/SVN::Depth)
- [SVN::Repos](https://metacpan.org/pod/SVN::Repos)
- [SVN::Client](https://metacpan.org/pod/SVN::Client)