use English qw(-no_match_vars);
use Rose::DB;
use Rose::DBx::Cache::Anywhere;
+use Scalar::Util qw(blessed);
use base qw(Rose::DB);
my $rv = 1;
local $@;
-
+ my $return_array = wantarray;
eval {
- wantarray
+ $return_array
? $self->do_transaction(sub { @result = $code->(@args) })
: $self->do_transaction(sub { $result = $code->(@args) });
} or do {
my $error = $self->error;
- if (ref $error) {
+ if (blessed $error) {
if ($error->isa('SL::X::DBError')) {
# gobble the exception
} else {
}
};
- return wantarray ? @result : $result;
+ return $return_array ? @result : $result;
}
1;