File Coverage

blib/lib/Apache/Auth/UserDB/File/Basic.pm
Criterion Covered Total %
statement 29 29 100.0
branch 1 2 50.0
condition n/a
subroutine 10 10 100.0
pod n/a
total 40 41 97.5


line stmt bran cond sub pod time code
1             #
2             # Apache::Auth::UserDB::File::Basic
3             # A Apache basic authentication file user database manager class.
4             #
5             # (C) 2003-2007 Julian Mehnle
6             # $Id: Basic.pm 31 2007-09-18 01:39:14Z julian $
7             #
8             ##############################################################################
9              
10             package Apache::Auth::UserDB::File::Basic;
11              
12 1     1   59625 use version; our $VERSION = qv('0.120');
  1         6456  
  1         8  
13              
14 1     1   120 use warnings;
  1         2  
  1         36  
15 1     1   6 use strict;
  1         2  
  1         36  
16              
17 1     1   6 use base qw(Apache::Auth::UserDB::File);
  1         4  
  1         1112  
18              
19 1     1   5 use Carp;
  1         5  
  1         61  
20              
21 1     1   582 use Apache::Auth::User::Basic;
  1         2  
  1         33  
22              
23             # Constants:
24             ##############################################################################
25              
26 1     1   6 use constant TRUE => (0 == 0);
  1         2  
  1         57  
27 1     1   5 use constant FALSE => not TRUE;
  1         2  
  1         230  
28              
29             # Interface:
30             ##############################################################################
31              
32             # Implementation:
33             ##############################################################################
34              
35             sub _parse_entry {
36 1     1   2 my ($self, $entry) = @_;
37            
38 1 50       42 $entry =~ /^([^:]*):([^:]*)$/
39             or croak('Malformed userdb entry encountered: "' . $entry . '"');
40            
41 1         7 return Apache::Auth::User::Basic->new(
42             name => $1,
43             password_digest => $2
44             );
45             }
46              
47             sub _build_entry {
48 2     2   4 my ($self, $user) = @_;
49            
50 2         11 return join(':',
51             $user->name,
52             $user->password_digest
53             );
54             }
55              
56             TRUE;