blib/script/rename

filter: Statementstmt 95.6% 22 / 23 Branchbran 56.2% 9 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 81.4% 35 / 43 CC 8 SCAR 17.7
CC
8
Cov
79%
main
8.3
mod_version
2.0
BEGIN
1.0
CRAP 5.8
« blib/lib/File/Rename.pm ↑ Summary blib/lib/File/Rename/Options.pm »
1 #!/usr/local/bin/perl -w
2 # $Revision$$Date$
3 # Robin's RCS header:
4 # RCSfile: rename.PL,v Revision: 1.3 Date: 2006/05/25 09:20:32
5 # Larry's RCS header:
6 # RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30
7 #
8 # Log: rename,v
9 # Revision 1.5 1998/12/18 16:16:31 rmb1
10 # moved to perl/source
11 # changed man documentation to POD
12 #
13 # Revision 1.4 1997/02/27 17:19:26 rmb1
14 # corrected usage string
15 #
16 # Revision 1.3 1997/02/27 16:39:07 rmb1
17 # added -v
18 #
19 # Revision 1.2 1997/02/27 16:15:40 rmb1
20 # *** empty log message ***
21 #
22 # Revision 1.1 1997/02/27 15:48:51 rmb1
23 # Initial revision
24 #
25
26 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 7 require File::Rename;
28 7 require File::Rename::Options;
29 7 ▶use Pod::Usage;
Subroutine BEGIN: called CC=1 SCAR=0.0
30
31 7 ▶main() unless caller;
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 7 7
32
33 sub main {
34 11 ▶ my $options = File::Rename::Options::GetOptions()
Subroutine main: called CC=7 SCAR=21.2
Branch: 1 branch
BranchTrueFalseTotal
my $options = File::Rename::Options::GetOptions() or pod2usage() 0 11 11
35 or pod2usage;
36
37 11 ▶ pod2usage( -verbose => 0,
Branch: 1 branch
BranchTrueFalseTotal
if File::Rename::Options::bad_encoding($options) 0 11 11
38 -exitval => 'NOEXIT',
39 -message => <<'MESSAGE',
40 -u|--unicode argument does not look like an encoding:
41 either give an encoding or put -e as next option
42 MESSAGE
43 ) if File::Rename::Options::bad_encoding($options);
44
45 11 ▶ mod_version() if $options->{show_version};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_version"} 1 10 11
46 10 ▶ pod2usage( -verbose => 2 ) if $options->{show_manual};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_manual"} 0 10 10
47 10 ▶ pod2usage( -exitval => 1 ) if $options->{show_help};
Branch: 1 branch
BranchTrueFalseTotal
if $options->{"show_help"} 0 10 10
48
49 10 ▶ @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;
Branch: 1 branch
BranchTrueFalseTotal
if $^O =~ /Win/msx 0 10 10
50
51 10 File::Rename::rename(\@ARGV, $options);
52 }
53
54 sub mod_version {
55 1 ▶ print __FILE__;
Subroutine mod_version: called CC=2 SCAR=7.0
56 1 print ' using File::Rename version '. $File::Rename::VERSION;
57 1 ▶ print ', File::Rename::Options version '. $File::Rename::Options::VERSION
Branch: 1 branch
BranchTrueFalseTotal
if eval $File::Rename::Options::VERSION < eval $File::Rename::VERSION 1 0 1
58 if (eval $File::Rename::Options::VERSION) < (eval $File::Rename::VERSION);
59 # ignore $File::Rename::Unicode::VERSION
60 1 print "\n\n";
61 1 exit 0
62 }
63
64 7 1;
65
66 __END__
« blib/lib/File/Rename.pm ↑ Summary blib/lib/File/Rename/Options.pm »