BerkeleyDB-Easy
view release on metacpan or search on metacpan
lib/BerkeleyDB/Easy/Error.pm view on Meta::CPAN
my ($self, $error, $extra, $flag) = @_;
our $HiRes ||= !!$self->_try(sub { require Time::HiRes });
my %exc = (
time => ($HiRes ? Time::HiRes::time() : time),
code => (int $error || int BDB_UNKNOWN),
);
# Populate package, file, line and sub attributes.
# If VERBOSE, get a full stack trace.
my $caller = $self->_caller(SKIP);
$exc{$_} = $caller->{$_} for qw(package file line sub);
$exc{trace} = BDB_VERBOSE
? $self->_carp
: qq(at $exc{file} line $exc{line}.);
my @detail = $extra;
# TODO: a lot of this needs to be reworked. Misbehaving parts
# commented out.
lib/BerkeleyDB/Easy/Error.pm view on Meta::CPAN
# (Complement to _lookup. Internal method, used by _assign)
#
# Convenience function for option parsing, for when the user
# gives us a string erorr name instead of an int or dualvar.
#
sub _const {
my ($self, $name) = @_;
DEBUG and $self->_debug(qq(Resolving constant: $name));
my $caller = $self->_caller(SKIP)->{package};
my $fullname = qq(&$caller\::$name);
# Resolve the name to a coderef. Look in our caller, this module,
# BerkeleyDB, and Errno, in that order.
my $func = $caller->can($name)
|| $self->can($name)
|| do { BerkeleyDB->can($name) }
|| do { require Errno; Errno->can($name) }
or $self->_throw(BDB_CONST, qq(Sub $fullname is undefined));
( run in 0.221 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )