Authentication/Store/Model/KiokuDB/UserWrapper.pm

filter: Statementstmt 42.8% 12 / 28 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 2 / 5 Podpod 33.3% 1 / 3 totaltotal 29.4% 15 / 51 CC 9 SCAR 41.4
CC
9
Cov
29%
supports
90.0
roles
2.0
for_session
2.0
CRAP 62.8
↑ Summary Model/KiokuDB.pm »
1 package Catalyst::Authentication::Store::Model::KiokuDB::UserWrapper;
2 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # FIXME massively cargo culted
7  
8 1 has directory => (
9 isa => "KiokuDB",
10 is => "ro",
11 required => 1,
12 );
13  
14 1 has 'user_object' => (
15 does => 'KiokuX::User',
16 reader => 'get_object',
17 required => 1,
18 handles => [qw(id check_password)],
19 );
20  
21 0 ▶sub roles { @{ shift->get_object->roles } };
Subroutine roles: not called CC=1 SCAR=6.9
Pod undocumented
22  
23 1 has [qw(auth_realm store)] => (
24 is => 'rw',
25 );
26  
27 1 my %supports = (
28 password => 'self_check',
29 roles => ["roles"],
30 session => 1,
31 );
32  
33 0 ▶sub supports {
Subroutine supports: not called CC=9 SCAR=45.0
Pod undocumented
34 0 my ($self, @spec) = @_;
35  
36 0 my $cursor = \%supports;
37  
38 0 ▶ return 1 if @spec == 1 and $self->can($spec[0]);
Branch: 1 branch
BranchTrueFalseTotal
if @spec == 1 and $self->can($spec[0]) 0 0 0
Condition0%0/3
@spec == 1 and $self->can($spec[0])
!ll&&!rl&&r
000
MC/DC0%0/2
@spec == 1 and $self->can($spec[0])
@spec == 1 $self->can($spec[0])
Truth table0%0/3
A and B
A= @spec == 1B= $self->can($spec[0])
ABresult
0X0
100
111
39  
40 # XXX is this correct?
41 0 for (@spec) {
42 0 ▶ return if ref($cursor) ne "HASH";
Branch: 1 branch
BranchTrueFalseTotal
if ref $cursor ne "HASH" 0 0 0
43 0 $cursor = $cursor->{$_};
44 }
45  
46 0 ▶ if (ref $cursor) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $cursor) { } 0 0 0
47 0 ▶ die "Bad feature spec: '@spec'" unless ref $cursor eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $cursor eq "ARRAY" 0 0 0
48 0 foreach my $key (@$cursor) {
49 0 ▶ return undef unless $self->can($key);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can($key) 0 0 0
50 }
51 0 return 1;
52 }
53 else {
54 0 return $cursor;
55 }
56 }
57  
58 0 ▶sub for_session {
Subroutine for_session: not called CC=1 SCAR=6.9
Pod documented
59 0 my $self = shift;
60  
61 # FIXME if session isa KiokuDB, no need to do anything
62 0 return $self->directory->object_to_id($self->get_object);
63 }
64  
65 1 __PACKAGE__->meta->make_immutable;
66  
67 1 __PACKAGE__
68  
69 __END__
↑ Summary Model/KiokuDB.pm »