Lite/RelyingParty/Discover/Fetcher/XRI.pm

filter: Statementstmt 85.7% 30 / 35 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 81.2% 39 / 48 CC 4 SCAR 10.0
CC
4
Cov
80%
fetch
4.9
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« Lite/SessionHandler.pm ↑ Summary Lite/RelyingParty/DirectCommunication.pm »
1 package OpenID::Lite::RelyingParty::Discover::Fetcher::XRI;
2  
3 2 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with 'OpenID::Lite::Role::ErrorHandler';
5 2 with 'OpenID::Lite::Role::AgentHandler';
6  
7 2 has 'proxy_url' => (
8 is => 'rw',
9 isa => 'Str',
10 );
11  
12 2 ▶use XRI::Resolution::Lite;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use OpenID::Lite::RelyingParty::Discover::FetchResult;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use OpenID::Lite::Constants::Yadis qw(XRDS_CONTENT_TYPE);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶sub fetch {
Subroutine fetch: called CC=4 SCAR=15.9
Pod undocumented
17 4 my ( $self, $iname, $option ) = @_;
18 4 my %params;
19 4 ▶ $params{ua} = $self->agent if $self->agent;
Branch: 1 branch
BranchTrueFalseTotal
if $self->agent 4 0 4
20 4 ▶ $params{resolver} = $self->proxy_url if $self->proxy_url;
Branch: 1 branch
BranchTrueFalseTotal
if $self->proxy_url 0 4 4
21 4 my $r = XRI::Resolution::Lite->new( {%params} );
22 4 my $xrds;
23 4 eval {
24 #XXX: XRI::Resolution::Lite handle type wrongly?
25 # Accept Header shouldn't be 'type' but 'format'.
26 $xrds = $r->resolve( $iname,
27 4 { format => XRDS_CONTENT_TYPE, type => $option->{service_type} } );
28 };
29 4 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 4 0 4
30 4 return $self->ERROR( sprintf q{Failed to resolve XRI iname "%s": %s},
31 $iname, $@ );
32 }
33 0 my $result = OpenID::Lite::RelyingParty::Discover::FetchResult->new;
34 0 $result->content_type( XRDS_CONTENT_TYPE );
35 0 $result->normalized_identifier($iname);
36 0 $result->xrds($xrds);
37 0 return $result;
38 }
39  
40 2 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 2 __PACKAGE__->meta->make_immutable;
42 2 1;
43  
« Lite/SessionHandler.pm ↑ Summary Lite/RelyingParty/DirectCommunication.pm »