blib/lib/HTML/EP/Install.pm

filter: Statementstmt 57.1% 24 / 42 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 63.6% 7 / 11 Podpod 0.0% 0 / 3 totaltotal 38.2% 31 / 81 CC 11 SCAR 27.6
CC
11
Cov
37%
InstallFiles
30.0
__ANON__
30.0
InstallHtmlFiles
6.0
CRAP 15.8
« blib/lib/HTML/EP/CGIEncryptForm.pm ↑ Summary blib/lib/HTML/EP/Locale.pm »
1 # -*- perl -*-
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use File::Path ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use File::Find ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Copy ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Spec ();
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Cwd();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 package HTML::EP::Install;
12  
13 1 ▶use vars qw($VERSION $install_files $install_cgi_files);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 $VERSION = '0.02';
16 1 $install_files = '\.(?:html?|ep|gif|jpe?g)$';
17 1 $install_cgi_files = '\.(?:cgi|pl)$';
18  
19  
20 0 ▶sub InstallFiles {
Subroutine InstallFiles: not called CC=5 SCAR=34.0
Pod undocumented
21 0 ▶ my($fromDir, $toDir, $extension, $mode) = @_ ? @_ : @ARGV;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
22 0 ▶ $mode = 0644 unless $mode;
Branch: 1 branch
BranchTrueFalseTotal
unless $mode 0 0 0
23 0 my $current_dir = Cwd::cwd();
24 0 ▶ chdir $fromDir || die "Failed to change directory to $fromDir: $!";
Branch: 1 branch
BranchTrueFalseTotal
chdir $fromDir or die "Failed to change directory to ${fromDir}: $!" 0 0 0
25 0 ▶ my $copySub = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
26 0 ▶ return unless $_ =~ /$extension/;
Branch: 1 branch
BranchTrueFalseTotal
unless $_ =~ /$extension/ 0 0 0
27 0 my $file = $_;
28 0 my $target_dir = File::Spec->catdir($toDir, $File::Find::dir);
29 0 ▶ (File::Path::mkpath($target_dir, 0, 0755)
Branch: 1 branch
BranchTrueFalseTotal
unless -d $target_dir 0 0 0
Condition0%0/5
-d $target_dir || (File::Path::mkpath($target_dir, 0, 493) || die("Failed to create ${target_dir}: $!"))
l!l&&r!l&&!r
000
File::Path::mkpath($target_dir, 0, 493) or die "Failed to create ${target_dir}: $!"
l!l
00
MC/DC0%0/2
-d $target_dir || (File::Path::mkpath($target_dir, 0, 493) || die("Failed to create ${target_dir}: $!"))
-d $target_dir File::Path::mkpath($target_dir, 0, 493)
Truth table0%0/3
A || B
A= -d $target_dirB= File::Path::mkpath($target_dir, 0, 493)
ABresult
1X1
011
000
30 or die "Failed to create $target_dir: $!")
31 unless -d $target_dir;
32 0 my $target_file = File::Spec->catfile($target_dir, $file);
33 0 ▶ File::Copy::copy($file, $target_file)
Branch: 1 branch
BranchTrueFalseTotal
File::Copy::copy($file, $target_file) or die "Failed to copy $File::Find::name to ${target_file}: $!" 0 0 0
34 || die "Failed to copy $File::Find::name to $target_file: $!";
35 0 chmod($mode, $target_file);
36 0 };
37 0 File::Find::find($copySub, ".");
38 0 ▶ chdir $current_dir || die "Failed to change directory to $current_dir: $!";
Branch: 1 branch
BranchTrueFalseTotal
chdir $current_dir or die "Failed to change directory to ${current_dir}: $!" 0 0 0
39 }
40  
41 0 ▶sub InstallHtmlFiles {
Subroutine InstallHtmlFiles: not called CC=2 SCAR=17.9
Pod undocumented
42 0 ▶ my($fromDir, $toDir) = @_ ? @_ : @ARGV;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
43 0 InstallFiles($fromDir, $toDir, $install_files);
44 }
45  
46 0 ▶sub InstallCgiFiles {
Subroutine InstallCgiFiles: not called CC=2 SCAR=17.9
Pod undocumented
47 0 ▶ my($fromDir, $toDir) = @_ ? @_ : @ARGV;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
48 0 InstallFiles($fromDir, $toDir, $install_cgi_files, 0755);
49 }
« blib/lib/HTML/EP/CGIEncryptForm.pm ↑ Summary blib/lib/HTML/EP/Locale.pm »