File Coverage

blib/lib/Cassandra/Client/Policy/Auth/Password.pm
Criterion Covered Total %
statement 8 21 38.1
branch 0 4 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 11 36 30.5


line stmt bran cond sub pod time code
1             package Cassandra::Client::Policy::Auth::Password;
2             our $AUTHORITY = 'cpan:TVDW';
3             $Cassandra::Client::Policy::Auth::Password::VERSION = '0.21';
4 13     13   224 use 5.010;
  13         54  
5 13     13   93 use strict;
  13         37  
  13         439  
6 13     13   82 use warnings;
  13         39  
  13         4708  
7              
8             sub new {
9 0     0 0   my ($class, %args)= @_;
10              
11 0           my $username= delete $args{username};
12 0           my $password= delete $args{password};
13              
14 0           return bless {
15             username => $username,
16             password => $password,
17             }, $class;
18             }
19              
20             sub begin {
21 0     0 0   my ($self)= @_;
22 0           return $self; # We are not a stateful implementation
23             }
24              
25             sub evaluate {
26 0     0 0   my ($self, $callback, $challenge)= @_;
27 0           my $user= $self->{username};
28 0           my $pass= $self->{password};
29 0 0         utf8::encode($user) if utf8::is_utf8($user);
30 0 0         utf8::encode($pass) if utf8::is_utf8($pass);
31 0           return $callback->(undef, "\0$user\0$pass");
32             }
33              
34             sub success {
35 0     0 0   my ($self)= @_;
36             # Ignored
37             }
38              
39             1;
40              
41             __END__