PlugAuth/Plugin/FlatUserList.pm

filter: Statementstmt 76.1% 16 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 50.0% 1 / 2 totaltotal 72.4% 21 / 29 CC 1 SCAR 2.9
CC
1
Cov
76%
init
2.0
check_credentials
2.0
BEGIN
1.0
CRAP 1.3
« PlugAuth/Role/Plugin.pm ↑ Summary PlugAuth/Role/Refresh.pm »
1 package PlugAuth::Plugin::FlatUserList;
2  
3 # ABSTRACT: PlugAuth plugin that provides a user list without authentication.
4 1 our $VERSION = '0.39'; # VERSION
5  
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::stat qw( stat );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 with 'PlugAuth::Role::Plugin';
13 1 with 'PlugAuth::Role::Auth';
14  
15 sub init
16 0 ▶{
Subroutine init: not called CC=1 SCAR=6.9
Pod undocumented
17 0 my($self) = @_;
18 0 $self->{filename} = $self->plugin_config->user_list_file;
19 0 $self->{mtime} = 0;
20 }
21  
22  
23 sub check_credentials
24 0 ▶{
Subroutine check_credentials: not called CC=1 SCAR=6.9
Pod documented
25 0 my($self, $user, $pass) = @_;
26 0 return $self->deligate_check_credentials($user, $pass);
27 }
28  
29  
30 sub all_users
31 {
32 my($self) = @_;
33 my $mtime = stat($self->{filename})->mtime;
34 if($mtime != $self->{mtime})
35 {
36 open(my $fh, '<', $self->{filename});
37 my @list = grep !/^\s*$/, <$fh>;
38 chomp @list;
39 close $fh;
40 $self->{mtime} = $mtime;
41 $self->{list} = \@list;
42 }
43 return @{ $self->{list} };
44 }
45  
46 1 1;
47  
48 __END__
« PlugAuth/Role/Plugin.pm ↑ Summary PlugAuth/Role/Refresh.pm »