I have been using Crypt::X509 before, but now I porting my code to newer supported library Crypt::OpenSSL::X509. The most important fields in the certificate are CN and SAN, I expect there are a simple call like:
use Crypt::X509;
print $x509->$cert_hr->SubjectAltName;
But instead I have to use cumbersome code:
use Crypt::OpenSSL::X509;
my $ext = $x509->extensions_by_oid();
print ${$ext}{'2.5.29.17'}->value();
But what makes it worse, returned string has parasitic "." inside, and I need to create some smart regular expressions to safely clean it.
I feel I am missing something simple. Is there another function or library?
Edit: Test results: Proposed Timothy solution works as long as you updated to latest version of library. Cannot add comment, neither press 'Accepted answer.' Will re-visit later.