ZofCMS/Plugin/FileList.pm

filter: Statementstmt 34.3% 11 / 32 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 10 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 19.1% 14 / 73 CC 15 SCAR 52.5
CC
15
Cov
18%
process
240.0
new
2.0
BEGIN
1.0
CRAP 189.7
« ZofCMS/Plugin/QuickNote.pm ↑ Summary ZofCMS/Plugin/DBIPPT.pm »
1 package App::ZofCMS::Plugin::FileList;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.001010'; # VERSION
7  
8 1 ▶use File::Glob (qw/bsd_glob/);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub new { bless {}, shift }
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
11  
12 0 ▶sub process {
Subroutine process: not called CC=15 SCAR=54.8
Pod undocumented
13 0 my ( $self, $template, $query, $config ) = @_;
14  
15 return
16 unless $template->{plug_file_list}
17 0 ▶ or $config->conf->{plug_file_list};
Branch: 1 branch
BranchTrueFalseTotal
unless $template->{"plug_file_list"} or $config->conf->{"plug_file_list"} 0 0 0
Condition0%0/3
$template->{"plug_file_list"} or $config->conf->{"plug_file_list"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$template->{"plug_file_list"} or $config->conf->{"plug_file_list"}
$template->{"plug_file_list"} $config->conf->{"plug_file_list"}
Truth table0%0/3
A or B
A= $template->{"plug_file_list"}B= $config->conf->{"plug_file_list"}
ABresult
1X1
011
000
18  
19 my %conf = (
20 name => 1,
21 0 ▶ %{ delete $config->conf->{plug_file_list} || {} },
Condition0%0/2
delete $config->conf->{'plug_file_list'} || {}
l!l
00
MC/DC0%0/1
delete $config->conf->{'plug_file_list'} || {}
delete $config->conf->{'plug_file_list'}
Truth table0%0/2
A
A= delete $config->conf->{'plug_file_list'}
Aresult
11
00
22 0 ▶ %{ delete $template->{plug_file_list} || {} },
Condition0%0/2
delete $template->{'plug_file_list'} || {}
l!l
00
MC/DC0%0/1
delete $template->{'plug_file_list'} || {}
delete $template->{'plug_file_list'}
Truth table0%0/2
A
A= delete $template->{'plug_file_list'}
Aresult
11
00
23 );
24  
25 return
26 0 ▶ unless defined $conf{list};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $conf{"list"} 0 0 0
27  
28 0 ▶ if ( not ref $conf{list} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not ref $conf{'list'}) { } 0 0 0
elsif (ref $conf{'list'} eq 'ARRAY') { } 0 0 0
29 0 $conf{list} = { plug_file_list => [ $conf{list} ] };
30 }
31 elsif ( ref $conf{list} eq 'ARRAY' ) {
32 0 $conf{list} = { plug_file_list => $conf{list} };
33 }
34  
35 0 keys %{ $conf{list} };
36 0 ▶ while( my ( $t_key, $files ) = each %{ $conf{list} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$conf{"list"};}) 0 0 0
37 0 ▶ ref $files
Branch: 1 branch
BranchTrueFalseTotal
ref $files or $files = [$files] 0 0 0
38 or $files = [ $files ];
39  
40 0 my @list;
41 0 for ( @$files ) {
42 0 ▶ substr($_, -1, 1) eq '/'
Branch: 1 branch
BranchTrueFalseTotal
substr($_, -1, 1) eq "/" or substr($_, -1, 1) eq "\\" or $_ .= '/' 0 0 0
Condition0%0/3
substr($_, -1, 1) eq "/" or substr($_, -1, 1) eq "\\"
l!l&&r!l&&!r
000
MC/DC0%0/2
substr($_, -1, 1) eq "/" or substr($_, -1, 1) eq "\\"
substr($_, -1, 1) eq "/" substr($_, -1, 1) eq "\\"
Truth table0%0/3
A or B
A= substr($_, -1, 1) eq "/"B= substr($_, -1, 1) eq "\\"
ABresult
1X1
011
000
43 or substr($_, -1, 1) eq '\\'
44 or $_ .= '/';
45 0 my @current_list = bsd_glob $_ . '*';
46 0 ▶ push @list, $conf{re} ? ( grep /$conf{re}/, @current_list ) : @current_list;
Branch: 1 branch
BranchTrueFalseTotal
$conf{'re'} ? : 0 0 0
47 }
48 $template->{t}{ $t_key } = [
49 map +{
50 path => $_,
51 0 ▶ ( $conf{name} ? ( name => (split '/')[-1] ) : () ),
Branch: 1 branch
BranchTrueFalseTotal
$conf{'name'} ? : 0 0 0
52 }, @list,
53 ];
54 }
55 }
56  
57 1 1;
58 __END__
« ZofCMS/Plugin/QuickNote.pm ↑ Summary ZofCMS/Plugin/DBIPPT.pm »