File Coverage

blib/lib/OpenID/Lite/RelyingParty/Discover/Parser/Yadis.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package OpenID::Lite::RelyingParty::Discover::Parser::Yadis;
2              
3 1     1   9 use Any::Moose;
  1         2  
  1         8  
4 1     1   709 use OpenID::Lite::Constants::Yadis qw(XRDS_CONTENT_TYPE);
  1         4  
  1         74  
5              
6             with 'OpenID::Lite::Role::ErrorHandler';
7             with 'OpenID::Lite::Role::Parser';
8              
9 1     1   903 use OpenID::Lite::RelyingParty::Discover::Parser::XRDS;
  0            
  0            
10             use OpenID::Lite::RelyingParty::Discover::Parser::HTML;
11              
12             sub parse {
13             my ( $self, $result ) = @_;
14             my $parser = $self->create_parser_for( $result );
15             my $service = $parser->parse( $result )
16             or return $self->ERROR( $parser->errstr );
17             return $service;
18             }
19              
20             sub create_parser_for {
21             my ( $self, $result ) = @_;
22             my $xrds_regex = quotemeta XRDS_CONTENT_TYPE;
23             my $parser
24             = ( $result->content_type =~ /^$xrds_regex/i )
25             ? OpenID::Lite::RelyingParty::Discover::Parser::XRDS->new
26             : OpenID::Lite::RelyingParty::Discover::Parser::HTML->new;
27             }
28              
29             no Any::Moose;
30             __PACKAGE__->meta->make_immutable;
31             1;