Branch Coverage

blib/lib/Captive/Portal/Role/Session.pm
Criterion Covered Total %
branch 30 68 44.1


line true false branch
82 0 3 unless $ip = $query->remote_addr
90 0 3 unless ($mac_from_arptable)
113 0 3 if $error
115 2 1 unless ($session)
124 1 0 if ($mac_from_arptable eq $$session{'MAC'})
144 0 0 if ($$session{'STATE'} eq 'active')
170 0 5 unless (-d $sessions_dir)
183 0 0 if $error
188 0 5 unless -w $sessions_dir
221 0 52 if $error
238 0 9 unless opendir my $dir_handle, $sessions_dir
267 0 111 unless exists $opts{'key'}
284 0 9 unless my $fh = shift()
289 0 9 unless seek $fh, 0, 0
294 0 9 unless (defined $slurp)
300 3 6 if $slurp eq ''
305 0 6 if ($error)
325 0 4 unless my $fh = shift()
328 0 4 unless my $session = shift()
333 0 4 unless seek $fh, 0, 0
334 0 4 unless truncate $fh, 0
336 0 4 unless print $fh 'JSON'->new->pretty->encode($session)
349 0 52 unless my $key = shift()
356 0 52 unless unlink $fname
368 0 2 unless my $session = $$self{'CTX'}{'SESSION'}
371 0 2 unless my $query = $$self{'CTX'}{'QUERY'}
375 1 1 if ($value = $$session{'COOKIE'}) { }
389 2 0 $self->cfg->{'SSL_REQUIRED'} ? :
0 2 unless my $cookie = $query->cookie(-'name', 'CaPo', -'value', $value, -'httponly', 1, $self->cfg->{'SSL_REQUIRED'} ? (-'secure', 1) : ())
410 0 0 unless my $query = $$self{'CTX'}{'QUERY'}
413 0 0 unless my $session = $$self{'CTX'}{'SESSION'}
416 0 0 unless $$session{'COOKIE'}
419 0 0 unless $request_cookie
421 0 0 if $request_cookie eq $$session{'COOKIE'}