>You should use the full LWP::UserAgent so you can disable SSL certificate checking, or use HTTP::Tiny, which has it disabled by default:
Certificate validation is there for a reason and simply recommending to switch it off is essentially suggesting to abandon any security provided by https since man in the middle attacks are easy if proper certificate validation is not done. The real reason that the code fails is a broken setup of the target site. This can be worked around in a secure way by setting SSL_ca_file to the appropriate CA certificates or by using SSL_fingerprint. For details see Stackoverflow where the question was also asked and I've answered it in detail.