| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 26 | |||||||||||||||
| 27 | 0 | ▶ | opendir my $dir, $path or die "Can't open directory '$path': $!"; | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 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; | |||||||||||||