lib/Serge/Sync/Util.pm

filter: Statementstmt 29.0% 9 / 31 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 33.3% 2 / 6 Podpod 0.0% 0 / 4 totaltotal 20.7% 11 / 53 SCAR 34.4
CC
7
Cov
21%
get_directory_contents
12.0
get_directory_contents
12.0
escape_path
6.0
CRAP 31.2
« lib/Serge/Engine/Plugin/parse_master.pm ↑ Summary lib/Serge/Util/WordStats.pm »
1 package Serge::Sync::Util;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our @ISA = qw(Exporter);
6  
7 1 our @EXPORT = qw(
8 escape_path
9 get_directory_contents
10 );
11  
12 sub escape_path {
13 0 ▶ my $path = shift;
Subroutine escape_path: not called CC=2 SCAR=17.9
Subroutine escape_path: not called CC=2 SCAR=17.9
Pod undocumented
Pod undocumented
14  
15 0 ▶ if ($^O !~ /MSWin32/) { # assume we are on Unix if not on Windows
Branch: 2 branches
BranchTrueFalseTotal
unless ($^O =~ /MSWin32/) 0 0 0
unless ($^O =~ /MSWin32/) 0 0 0
16 0 $path =~ s/\$/\\\$/sg; # escape dollar sign
17 }
18  
19 0 return $path;
20 }
21  
22 # return top-level directory contents (files and folder names)
23 sub get_directory_contents {
24 0 ▶ my $path = shift;
Subroutine get_directory_contents: not called CC=3 SCAR=24.8
Subroutine get_directory_contents: not called CC=3 SCAR=24.8
Pod undocumented
Pod undocumented
25 0 ▶ $path = '.' unless $path;
Branch: 2 branches
BranchTrueFalseTotal
unless $path 0 0 0
unless $path 0 0 0
26  
27 0 ▶ opendir my $dir, $path or die "Can't open directory '$path': $!";
Branch: 2 branches
BranchTrueFalseTotal
opendir my $dir, $path or die "Can't open directory '${path}': $!" 0 0 0
opendir my $dir, $path or die "Can't open directory '${path}': $!" 0 0 0
28 0 my @a = grep {!/^\.+$/} readdir $dir; # grep everything except '.' and '..'
29 0 closedir $dir;
30  
31 0 return @a;
32 }
33  
34 1 1;
« lib/Serge/Engine/Plugin/parse_master.pm ↑ Summary lib/Serge/Util/WordStats.pm »