use strict;
use warnings;
use Carp::Clan qw/^DBIx::Class/;
+use Try::Tiny;
our %_pod_inherit_config =
(
sub _get_primary_key {
my ( $class, $target_class ) = @_;
$target_class ||= $class;
- my ($pri, $too_many) = eval { $target_class->_pri_cols };
- $class->throw_exception(
- "Can't infer join condition on ${target_class}: $@"
- ) if $@;
+ my ($pri, $too_many) = try { $target_class->_pri_cols }
+ catch {
+ $class->throw_exception("Can't infer join condition on ${target_class}: $@");
+ };
$class->throw_exception(
"might_have/has_one can only infer join for a single primary key; ".