Found it. The problem was that the following:
printf("%s -> %s:%s\n", $cxn->name(), $cxn->{dsn}->{h}, $cxn->{dsn}->{P});
dies when $cxn->{dsn}->{P} is undefined. In my case, it is, because it's connecting to localhost via a UNIX socket. No port number.
I can work around it by specifying 3306 in my DSN, which forces TCP instead of UNIX sockets. Then everything works.
A fix is to do something like:
$cxn->{dsn}->{P} || 'socket'
instead of simply
$cxn->{dsn}->{P}
in that printf.
One issue is that the same printf appears three different times in the code. It might make sense to centralize that. I'm attaching a diff that I believe fixes everything.
Found it. The problem was that the following:
printf("%s -> %s:%s\n", $cxn->name(), $cxn->{dsn}->{h}, $cxn->{dsn}->{P});
dies when $cxn->{dsn}->{P} is undefined. In my case, it is, because it's connecting to localhost via a UNIX socket. No port number.
I can work around it by specifying 3306 in my DSN, which forces TCP instead of UNIX sockets. Then everything works.
A fix is to do something like:
$cxn->{dsn}->{P} || 'socket'
instead of simply
$cxn->{dsn}->{P}
in that printf.
One issue is that the same printf appears three different times in the code. It might make sense to centralize that. I'm attaching a diff that I believe fixes everything.