Add some uncoverable comments
[plack-middleware-auth-complex.git] / lib / Plack / Middleware / Auth / Complex.pm
index f30f412f4cc01cf5f29f7351ad05e7e5a9694555..fe545482597db1e9ed2c1f1e8737b61842c69550 100644 (file)
@@ -49,7 +49,7 @@ sub new {
 sub init {
        my ($self) = @_;
        $self->{dbh} = DBI->connect(@{$self->{dbi_connect}})              or die $DBI::errstr;
-       $self->{post_connect_cb}->($self) if $self->{post_connect_cb};
+       $self->{post_connect_cb}->($self) if $self->{post_connect_cb}; # uncoverable branch false
        $self->{insert_sth} = $self->{dbh}->prepare($self->{insert_user}) or die $self->{dbh}->errstr;
        $self->{select_sth} = $self->{dbh}->prepare($self->{select_user}) or die $self->{dbh}->errstr;
        $self->{update_sth} = $self->{dbh}->prepare($self->{update_pass}) or die $self->{dbh}->errstr;
@@ -74,7 +74,7 @@ sub check_passphrase {
                $self->{cache} = \%cache;
        }
        my $cachekey = sha256 "$username:$passphrase";
-       return $self->{cache}{$cachekey} if exists $self->{cache}{$cachekey};
+       return $self->{cache}{$cachekey} if exists $self->{cache}{$cachekey}; # uncoverable branch true
        my $user = $self->get_user($username);
        return 0 unless $user;
        my $ret = Authen::Passphrase->from_rfc2307($user->{passphrase})->match($passphrase);
@@ -98,7 +98,7 @@ sub set_passphrase {
 
 sub make_reset_hmac {
        my ($self, $username, @data) = @_;
-       $self->{hmackey} //= random_bytes 512;
+       $self->{hmackey} //= random_bytes 512; # uncoverable condition false
        my $user = $self->get_user($username);
        my $message = join ' ', $username, $user->{passphrase}, @data;
        hmac_sha1_base64 $message, $self->{hmackey};
@@ -107,7 +107,7 @@ sub make_reset_hmac {
 sub mail_body {
        my ($self, $username, $token) = @_;
        my $hours = $self->{token_max_age} / 60 / 60;
-       $hours .= $hours == 1 ? ' hour' : ' hours';
+       $hours .= $hours == 1 ? ' hour' : ' hours'; # uncoverable branch false
        <<EOF;
 Someone has requested a password reset for your account.
 
This page took 0.011184 seconds and 4 git commands to generate.