blib/lib/Crypt/Perl/X509/InfoAccessBase.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 48 CC 2 SCAR 10.3
CC
2
Cov
0%
new
6.0
_encode_params
2.0
BEGIN
2.0
CRAP 2.8
1 package Crypt::Perl::X509::InfoAccessBase;
2  
3 use strict;
4 use warnings;
5  
6 use parent qw( Crypt::Perl::X509::Extension );
7  
8 use Crypt::Perl::X509::GeneralName ();
9 use Crypt::Perl::X ();
10  
11 use constant ASN1 => Crypt::Perl::X509::GeneralName::ASN1() . <<END;
12 InfoAccess ::= SEQUENCE OF AccessDescription
13  
14 AccessDescription ::= SEQUENCE {
15 accessMethod OBJECT IDENTIFIER,
16 accessLocation ANY -- GeneralName
17 }
18 END
19  
20 use constant {
21 asn1_macro => 'InfoAccess',
22 CRITICAL => 0,
23 };
24  
25 sub new {
26 my ($class, @accessDescrs) = @_;
27  
28 if (!@accessDescrs) {
29 die Crypt::Perl::X::create('Generic', 'Need access descriptions!');
30 }
31  
32 return bless \@accessDescrs, $class;
33 }
34  
35 sub _encode_params {
36 my ($self) = @_;
37  
38 my $data = [
39 map {
40 $self->can("OID_$_->[0]") or die( Crypt::Perl::X::create('Generic', "Unknown method: “$_->[0]”") );
41  
42 {
43 accessMethod => $self->can("OID_$_->[0]")->(),
44 accessLocation => Crypt::Perl::X509::GeneralName->new( @{$_}[1,2] )->encode(),
45 }
46 } @$self,
47 ];
48  
49 return $data;
50 }
51  
52 1;