lib/Kwiki/WebFile.pm

filter: Statementstmt 82.5% 33 / 40 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 20.0% 1 / 5 totaltotal 74.1% 43 / 58 CC 4 SCAR 8.0
CC
4
Cov
80%
add_file
4.2
files_which_exist
2.0
clear_files
2.0
CRAP 2.2
« lib/Kwiki/Installer.pm ↑ Summary lib/Kwiki/CGI.pm »
1 package Kwiki::WebFile;
2 6 ▶use Kwiki::Base -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use Spoon::Base 'conf';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 our @EXPORT = qw(conf);
6  
7 6 field path => [];
8 6 field files => [];
9 6 const default_path_method => 'default_path';
10  
11 6 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
12 6 my $method = $self->default_path_method;
13 6 $self->add_path(@{$self->$method});
14 }
15  
16 6 ▶sub add_file {
Subroutine add_file: called CC=4 SCAR=14.2
Pod undocumented
17 6 ▶ my $file = shift
Branch: 1 branch
BranchTrueFalseTotal
my $file = shift() or return 6 0 6
18 or return;
19 6 my $file_path = '';
20 6 for (@{$self->path}) {
21 6 ▶ $file_path = "$_/$file", last
Branch: 1 branch
BranchTrueFalseTotal
if -f "$_/$file" 0 6 6
22 if -f "$_/$file";
23 }
24 6 my $files = $self->files;
25 0 @$files = grep { not /\/$file$/ } @$files;
26 6 push @$files, $file_path;
27 }
28  
29 0 ▶sub files_which_exist {
Subroutine files_which_exist: not called CC=1 SCAR=6.9
Pod undocumented
30 0 grep {io->file($_)->exists} @{$self->files};
31 }
32  
33 6 ▶sub add_path {
Subroutine add_path: called CC=1 SCAR=0.0
Pod undocumented
34 6 unshift @{$self->path}, @_;
35 }
36  
37 0 ▶sub clear_files {
Subroutine clear_files: not called CC=1 SCAR=6.9
Pod undocumented
38 0 $self->files([]);
39 }
40  
41 6 __DATA__
« lib/Kwiki/Installer.pm ↑ Summary lib/Kwiki/CGI.pm »