| 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
Condition0%0/3
$template->{"plug_file_list"} or $config->conf->{"plug_file_list"}
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"}
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | my %conf = ( | ||||||||||||||||||||||||||||
| 20 | name => 1, | ||||||||||||||||||||||||||||
| 21 | 0 | ▶ | %{ delete $config->conf->{plug_file_list} || {} }, | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $config->conf->{'plug_file_list'} || {}
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'}
| |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | %{ delete $template->{plug_file_list} || {} }, | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $template->{'plug_file_list'} || {}
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'}
| |||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | return | ||||||||||||||||||||||||||||
| 26 | 0 | ▶ | unless defined $conf{list}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ( not ref $conf{list} ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | ref $files | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | or $files = [ $files ]; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | my @list; | |||||||||||||||||||||||||||
| 41 | 0 | for ( @$files ) { | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | substr($_, -1, 1) eq '/' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
substr($_, -1, 1) eq "/" or substr($_, -1, 1) eq "\\"
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 "\\"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | $template->{t}{ $t_key } = [ | ||||||||||||||||||||||||||||
| 49 | map +{ | ||||||||||||||||||||||||||||
| 50 | path => $_, | ||||||||||||||||||||||||||||
| 51 | 0 | ▶ | ( $conf{name} ? ( name => (split '/')[-1] ) : () ), | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | }, @list, | ||||||||||||||||||||||||||||
| 53 | ]; | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||