From: Daniel Kahn Gillmor Date: Mon, 18 Oct 2010 06:22:00 +0000 (-0400) Subject: do not force msva-query-client to depend on Crypt::X509 X-Git-Tag: msva-perl_debian/0.6-1~3^2~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e55027156ffd7b0d866bd56d3d9e5a49d8e78fb;p=monkeysphere-validation-agent.git do not force msva-query-client to depend on Crypt::X509 --- diff --git a/Crypt/Monkeysphere/MSVA/Client.pm b/Crypt/Monkeysphere/MSVA/Client.pm index e242836..f586f9a 100644 --- a/Crypt/Monkeysphere/MSVA/Client.pm +++ b/Crypt/Monkeysphere/MSVA/Client.pm @@ -29,7 +29,6 @@ use Crypt::Monkeysphere::MSVA::Logger; use LWP::UserAgent; use HTTP::Request; - require Crypt::X509; sub log { my $self = shift; @@ -87,15 +86,17 @@ $self->log('debug', "pkctype: %s\n", $pkctype); if ($pkctype eq 'x509der') { - my $cert = Crypt::X509->new(cert => $pkcdata); - if ($cert->error) { - die; - }; - $self->log('info', "x509der certificate loaded.\n"); - $self->log('verbose', "cert subject: %s\n", $cert->subject_cn()); - $self->log('verbose', "cert issuer: %s\n", $cert->issuer_cn()); - $self->log('verbose', "cert pubkey algo: %s\n", $cert->PubKeyAlg()); - $self->log('verbose', "cert pubkey: %s\n", unpack('H*', $cert->pubkey())); + if (Module::Load::Conditional::can_load('modules' => { 'Crypt::X509' => undef })) { + my $cert = Crypt::X509->new(cert => $pkcdata); + if ($cert->error) { + die; + }; + $self->log('info', "x509der certificate loaded.\n"); + $self->log('verbose', "cert subject: %s\n", $cert->subject_cn()); + $self->log('verbose', "cert issuer: %s\n", $cert->issuer_cn()); + $self->log('verbose', "cert pubkey algo: %s\n", $cert->PubKeyAlg()); + $self->log('verbose', "cert pubkey: %s\n", unpack('H*', $cert->pubkey())); + } } else { $self->log('error', "unknown pkc type '%s'.\n", $pkctype); };