script/rename

filter: Statementstmt 96.6% 29 / 30 Branchbran 55.5% 10 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 83.3% 45 / 54 CC 9 SCAR 15.8
CC
9
Cov
81%
main
7.9
mod_version
3.0
BEGIN
1.0
CRAP 4.9
« lib/File/Rename/Options.pm ↑ Summary script/unsafe-rename »
1 #!/usr/local/bin/perl
2 6 ▶use 5.032; # use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3
4 6 ▶use File::Rename; # REQUIRE_ORDER
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use Pod::Usage;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 6 ▶main() unless caller;
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 6 6
8
9 11 ▶sub main {
Subroutine main: called CC=7 SCAR=20.6
10 11 ▶ my $options = File::Rename::Options::GetOptions()
Branch: 1 branch
BranchTrueFalseTotal
my $options = File::Rename::Options::GetOptions() or pod2usage() 11 0 11
11 or pod2usage;
12
13 11 ▶ pod2usage( -verbose => 0,
Branch: 1 branch
BranchTrueFalseTotal
if File::Rename::Options::bad_encoding($options) 0 11 11
14 -exitval => 'NOEXIT',
15 -message => <<'MESSAGE',
16 -u|--unicode argument does not look like an encoding:
17 either give an encoding or put -e as next option
18 MESSAGE
19 ) if File::Rename::Options::bad_encoding($options);
20
21 11 ▶ mod_version() if $options->{show_version};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_version"} 1 10 11
22 10 ▶ pod2usage( -verbose => 2 ) if $options->{show_manual};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_manual"} 0 10 10
23 10 ▶ pod2usage( -exitval => 1 ) if $options->{show_help};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_help"} 0 10 10
24
25 0 ▶ @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;
Subroutine BEGIN: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
if $^O =~ /Win/msux 0 10 10
26
27 10 File::Rename::rename(\@ARGV, $options);
28 }
29
30 1 ▶sub mod_version {
Subroutine mod_version: called CC=3 SCAR=11.1
31 1 print __FILE__;
32 1 my $version = File::Rename->VERSION;
33 1 my $opt_ver = File::Rename::Options->VERSION;
34 1 print ' using File::Rename version '. $version;
35 1 ▶ if( (eval $opt_ver) < (eval $version) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (eval $opt_ver < eval $version) 1 0 1
36 1 ▶ $opt_ver .= '.00' unless $opt_ver =~ m{\.};
Branch: 1 branch
BranchTrueFalseTotal
unless $opt_ver =~ /\./u 0 1 1
37 1 print ', File::Rename::Options version '. $opt_ver;
38 }
39 # ignore File::Rename->VERSION
40 1 print "\n\n";
41 1 exit 0
42 }
43
44 6 1;
45
46 __END__
« lib/File/Rename/Options.pm ↑ Summary script/unsafe-rename »