blib/lib/Web/ID/SAN/URI.pm

filter: Statementstmt 100% 42 / 42 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 98.2% 56 / 57 CC 3 SCAR 3.8
CC
3
Cov
98%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« blib/lib/Web/ID/Certificate.pm ↑ Summary blib/lib/Web/ID/SAN.pm »
1 package Web::ID::SAN::URI;
2  
3 3 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 $Web::ID::SAN::URI::AUTHORITY = 'cpan:TOBYINK';
8 3 $Web::ID::SAN::URI::VERSION = '1.927';
9 }
10  
11 3 ▶use Web::ID::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Web::ID::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use namespace::sweep;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 extends 'Web::ID::SAN';
17  
18 3 has '+type' => (default => 'uniformResourceIdentifier');
19  
20 override uri_object => sub
21 12 ▶{
Subroutine __ANON__: called CC=1 SCAR=0.0
22 12 my ($self) = @_;
23 12 return Uri->coerce($self->value);
24 3 };
25  
26 around _build_model => sub
27 7 ▶{
Subroutine __ANON__: called CC=1 SCAR=0.0
28 7 my ($orig, $self) = @_;
29 7 my $model = $self->$orig;
30 7 return get_trine_model($self->value => $model);
31 3 };
32  
33 around associated_keys => sub
34 7 ▶{
Subroutine __ANON__: called CC=3 SCAR=11.0
35 7 my ($orig, $self) = @_;
36 7 my @keys = $self->$orig;
37
38 7 my $results = $self->_query->execute( $self->model );
39 7 ▶ RESULT: while (my $result = $results->next)
Branch: 1 branch
BranchTrueFalseTotal
if (my $result = $results->next) 5 7 12
40 {
41 # trim any whitespace around modulus
42 # (HACK for MyProfile WebIDs)
43 # Should probably be in ::Util.
44 5 $result->{modulus}->[0] =~ s/(^\s+)|(\s+$)//g;
45
46 my $modulus = make_bigint_from_node(
47 $result->{modulus},
48 fallback => $result->{hexModulus},
49 5 fallback_type =>'hex',
50 );
51 my $exponent = make_bigint_from_node(
52 $result->{exponent},
53 fallback => $result->{decExponent},
54 5 fallback_type =>'dec',
55 );
56
57 5 my $key = $self->key_factory->(
58 modulus => $modulus,
59 exponent => $exponent,
60 );
61 5 ▶ push @keys, $key if $key;
Branch: 1 branch
BranchTrueFalseTotal
if $key 5 0 5
62 }
63
64 7 return @keys;
65 3 };
66  
67 sub _query
68 7 ▶{
Subroutine _query: called CC=1 SCAR=0.0
69 7 my ($self) = @_;
70 7 return "RDF::Query"->new( sprintf(<<'SPARQL', (($self->uri_object)x4)) );
71 PREFIX cert: <http://www.w3.org/ns/auth/cert#>
72 PREFIX rsa: <http://www.w3.org/ns/auth/rsa#>
73 SELECT
74 ?modulus
75 ?exponent
76 ?decExponent
77 ?hexModulus
78 WHERE
79 {
80 {
81 ?key
82 cert:identity <%s> ;
83 rsa:modulus ?modulus ;
84 rsa:public_exponent ?exponent .
85 }
86 UNION
87 {
88 <%s> cert:key ?key .
89 ?key
90 rsa:modulus ?modulus ;
91 rsa:public_exponent ?exponent .
92 }
93 UNION
94 {
95 ?key
96 cert:identity <%s> ;
97 cert:modulus ?modulus ;
98 cert:exponent ?exponent .
99 }
100 UNION
101 {
102 <%s> cert:key ?key .
103 ?key
104 cert:modulus ?modulus ;
105 cert:exponent ?exponent .
106 }
107 OPTIONAL { ?modulus cert:hex ?hexModulus . }
108 OPTIONAL { ?exponent cert:decimal ?decExponent . }
109 }
110 SPARQL
111 }
112  
113 3 __PACKAGE__
114 __END__
« blib/lib/Web/ID/Certificate.pm ↑ Summary blib/lib/Web/ID/SAN.pm »