File Coverage

blib/lib/OpenID/Lite/RelyingParty/Discover/Method/URL.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package OpenID::Lite::RelyingParty::Discover::Method::URL;
2              
3 1     1   6 use Any::Moose;
  1         2  
  1         10  
4              
5 1     1   713 use OpenID::Lite::RelyingParty::Discover::Method::Yadis;
  0            
  0            
6             use OpenID::Lite::RelyingParty::Discover::Method::HTML;
7              
8             has '_methods' => (
9             is => 'ro',
10             isa => 'ArrayRef', # OpenID::Lite::RelyingParty::Discoverable composit
11             lazy_build => 1,
12             );
13              
14             with 'OpenID::Lite::Role::Discoverer';
15             with 'OpenID::Lite::Role::ErrorHandler';
16             with 'OpenID::Lite::Role::AgentHandler';
17              
18             sub discover {
19             my ( $self, $identifier ) = @_;
20              
21             # chain of responsibility
22             my $methods = $self->_methods;
23             for my $method (@$methods) {
24             my $services = $method->discover($identifier);
25             return $services if $services;
26             }
27              
28             return $self->ERROR(
29             sprintf q{Failed Yadis and HTML discovery for identifier "%s"},
30             $identifier );
31             }
32              
33             sub _build__methods {
34             my $self = shift;
35             [ OpenID::Lite::RelyingParty::Discover::Method::Yadis->new(
36             agent => $self->agent
37             ),
38             OpenID::Lite::RelyingParty::Discover::Method::HTML->new(
39             agent => $self->agent
40             ),
41             ];
42             }
43              
44             no Any::Moose;
45             __PACKAGE__->meta->make_immutable;
46             1;