File Coverage

blib/lib/Dancer/Plugin/Authen/Simple.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 30 30 100.0


line stmt bran cond sub pod time code
1 2     2   417801 use strict;
  2         4  
  2         68  
2 2     2   10 use warnings;
  2         3  
  2         119  
3              
4             package Dancer::Plugin::Authen::Simple;
5             {
6             $Dancer::Plugin::Authen::Simple::VERSION = '0.130500';
7             }
8 2     2   958 use Dancer ':syntax';
  2         259071  
  2         12  
9 2     2   2443 use Dancer::Plugin;
  2         2962  
  2         155  
10 2     2   1711 use Module::Load;
  2         2173  
  2         14  
11 2     2   1926 use Authen::Simple;
  2         13354  
  2         58  
12 2     2   1819 use Memoize;
  2         5453  
  2         434  
13              
14             #ABSTRACT: Easy Authentication for Dancer applications via Authen::Simple
15              
16              
17              
18              
19             sub authen
20             {
21 2     2   5911 _authen( plugin_setting() );
22             }
23              
24             memoize('_authen');
25             sub _authen
26             {
27             my $conf = shift;
28             my @adapters = ();
29             $DB::single = 1;
30             foreach my $adapter_name ( keys %$conf )
31             {
32             my $driver = "Authen::Simple::$adapter_name";
33             load $driver;
34             push @adapters, $driver->new( %{ $conf->{$adapter_name} } );
35             }
36             Authen::Simple->new(@adapters);
37             }
38              
39             register authen => \&authen;
40             register_plugin for_versions => [ 1, 2 ];
41              
42             __END__