Plugin/Authentication/Store/Minimal.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 94.4% 34 / 36 CC 3 SCAR 5.1
CC
3
Cov
96%
setup
3.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.7
« Plugin/Authentication/User/Hash.pm ↑ Summary Authentication/Store/Null.pm »
1 package Catalyst::Plugin::Authentication::Store::Minimal;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use MRO::Compat;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Catalyst::Authentication::Store::Minimal ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 ## backwards compatibility
10 4 ▶sub setup {
Subroutine setup: called CC=3 SCAR=11.0
Pod documented
11 4 my $c = shift;
12  
13 ### If a user does 'use Catalyst qw/Authentication::Store::Minimal/'
14 ### he will be proxied on to this setup routine (and only then --
15 ### non plugins should NOT have their setup routine invoked!)
16 ### Beware what we pass to the 'new' routine; it wants
17 ### a config has with a top level key 'users'. New style
18 ### configs do not have this, and split by realms. If we
19 ### blindly pass this to new, we will 1) overwrite what we
20 ### already passed and 2) make ->userhash undefined, which
21 ### leads to:
22 ### Can't use an undefined value as a HASH reference at
23 ### lib/Catalyst/Authentication/Store/Minimal.pm line 38.
24 ###
25 ### So only do this compatibility call if:
26 ### 1) we have a {users} config directive
27 ###
28 ### Ideally we could also check for:
29 ### 2) we don't already have a ->userhash
30 ### however, that's an attribute of an object we can't
31 ### access =/ --kane
32  
33 my $cfg = $c->config->{'Plugin::Authentication'}->{users}
34 4 ▶ ? $c->config->{'Plugin::Authentication'}
Branch: 1 branch
BranchTrueFalseTotal
$c->config->{'Plugin::Authentication'}{'users'} ? : 1 3 4
35 : undef;
36  
37 4 ▶ $c->default_auth_store( Catalyst::Authentication::Store::Minimal->new( $cfg, $c ) ) if $cfg;
Branch: 1 branch
BranchTrueFalseTotal
if $cfg 1 3 4
38  
39 4 $c->next::method(@_);
40 }
41  
42 4 foreach my $method (qw/ get_user user_supports find_user from_session /) {
43 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 0 ▶ *{$method} = sub { __PACKAGE__->default_auth_store->$method( @_ ) };
Subroutine __ANON__: not called CC=1 SCAR=0.4
45 }
46  
47 4 __PACKAGE__;
48  
49 __END__
« Plugin/Authentication/User/Hash.pm ↑ Summary Authentication/Store/Null.pm »