[Here](https://metacpan.org/source/DAPATRICK/XML-Stream-1.24/lib/XML/Stream.pm#L1973) you do not handle connection error. (the error occur when server has self-signed cert) in debug mode you modules report that `we are secure` but actually connection is not established Server logs report: SSL handshake failed See [here](https://stackoverflow.com/q/53400241/4632019) for more detailed info: