Branch Coverage

lib/Concierge/Sessions/File.pm
Criterion Covered Total %
branch 45 88 51.1


line true false branch
15 4 1 unless (-d $self->{'storage_dir'})
16 0 4 unless (mkdir $self->{'storage_dir'})
21 0 5 unless (chmod 0700, $self->{'storage_dir'})
32 0 5 unless $args{'user_id'}
45 0 5 unless (open $fh, ">", $session_file)
48 0 5 unless (chmod 0600, $session_file)
59 0 5 if (defined $timeout and $timeout eq 'indefinite') { }
82 0 5 unless (print $fh $json, "\n")
87 0 5 unless (close $fh)
97 0 10 unless ($session_id)
103 0 10 unless (-f $session_file)
108 0 10 unless (open $fh, "<", $session_file)
115 0 10 unless (close $fh)
118 0 10 unless (defined $json)
128 0 10 if ($@)
132 0 10 unless ($session_info->{'session_id'} and $session_info->{'created_at'} and $session_info->{'expires_at'})
137 0 10 if ($session_info->{'expires_at'} ne "indefinite" and time > $session_info->{'expires_at'})
151 0 2 unless ($session_id)
155 0 2 unless ($updates)
161 0 2 unless (open $fh, "+<", $session_file)
169 2 0 if ($json)
173 0 2 if ($@)
179 2 0 if (exists $updates->{'data'})
183 2 0 if (exists $updates->{'expires_at'})
194 0 2 unless (print $fh $new_json, "\n")
199 0 2 unless (close $fh)
209 0 1 unless ($session_id)
215 0 1 unless (-f $session_file)
219 0 1 unless (unlink $session_file)
230 0 1 unless (opendir $dh, $self->{'storage_dir'})
237 2 2 if $file =~ /^\.\.?$/u
239 0 2 if $file =~ /\.\w{1,6}$/u
242 2 0 if ($get_result->{'success'}) { }
248 0 0 if ($delete_result->{'success'})
254 0 1 unless (closedir $dh)
264 0 5 unless ($user_id)
268 0 5 unless opendir my $dh, $self->{'storage_dir'}
276 10 1 if $file =~ /^\.\.?$/u
277 0 1 if $file =~ /\.\w{1,6}$/u
282 0 1 unless open my $fh, "<", $session_file
287 0 1 unless defined $json
293 0 1 if $@
296 0 1 if ($session_info->{'user_id'} eq $user_id)
297 0 0 if (unlink $session_file)