Never mind: solved it. I was supplying the SSL_passwd_cb option as a variable instead of sub{$pass}.
In reply to Re: SSL error TLSv1.2 by flier in thread SSL error TLSv1.2 by flier