File Coverage

blib/script/rename
Criterion Covered Total %
statement 26 29 89.6
branch 8 16 50.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 40 51 78.4


line stmt bran cond sub pod time code
1             #!/usr/local/bin/perl
2 6     6   19257 use strict;
  6         12  
  6         198  
3 6     6   29 use warnings;
  6         10  
  6         146  
4            
5 6     6   2637 use File::Rename; # REQUIRE_ORDER
  6         13  
  6         33  
6 6     6   3845 use Pod::Usage;
  6         307622  
  6         2478  
7            
8             main() unless caller;
9            
10             sub main {
11 10 50   10   23542 my $options = File::Rename::Options::GetOptions()
12             or pod2usage;
13            
14 10 50       56 pod2usage( -verbose => 0,
15             -exitval => 'NOEXIT',
16             -message => <<'MESSAGE',
17             -u|--unicode argument does not look like an encoding:
18             either give an encoding or put -e as next option
19             MESSAGE
20             ) if File::Rename::Options::bad_encoding($options);
21            
22 10 100       40 mod_version() if $options->{show_version};
23 9 50       28 pod2usage( -verbose => 2 ) if $options->{show_manual};
24 9 50       22 pod2usage( -exitval => 1 ) if $options->{show_help};
25            
26 9 50       53 @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;
  0         0  
27            
28 9         66 File::Rename::rename(\@ARGV, $options);
29             }
30            
31             sub mod_version {
32 1     1   4 print __FILE__;
33 1         23 my $version = File::Rename->VERSION;
34 1         30 my $opt_ver = File::Rename::Options->VERSION;
35 1         5 print ' using File::Rename version '. $version;
36 1 50       56 if( (eval $opt_ver) < (eval $version) ) {
37 0 0       0 $opt_ver .= '.00' unless $opt_ver =~ m{\.};
38 0         0 print ', File::Rename::Options version '. $opt_ver;
39             }
40             # ignore File::Rename->VERSION
41 1         5 print "\n\n";
42 1         141 exit 0
43             }
44            
45             1;
46            
47             __END__