sub txn_do {
my ($self, $coderef, @args) = @_;
- ref $self or $self->throw_exception('Cannot execute txn_do as a '.
- 'class method');
+ ref $self or $self->throw_exception
+ ('Cannot execute txn_do as a class method');
+ ref $coderef eq 'CODE' or $self->throw_exception
+ ('$coderef must be a CODE reference');
my (@return_values, $return_value);