| 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
| |||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | $mode = 0644 unless $mode; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 23 | 0 | my $current_dir = Cwd::cwd(); | |||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | chdir $fromDir || die "Failed to change directory to $fromDir: $!"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $copySub = sub { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return unless $_ =~ /$extension/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 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
Condition0%0/5
-d $target_dir || (File::Path::mkpath($target_dir, 0, 493) || die("Failed to create ${target_dir}: $!"))
File::Path::mkpath($target_dir, 0, 493) or die "Failed to create ${target_dir}: $!"
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)
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 48 | 0 | InstallFiles($fromDir, $toDir, $install_cgi_files, 0755); | |||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||