File Coverage

blib/script/rename
Criterion Covered Total %
statement 28 29 96.5
branch 9 16 56.2
condition n/a
subroutine 6 6 100.0
pod n/a
total 43 51 84.3


line stmt bran cond sub pod time code
1             #!/usr/local/bin/perl
2 6     6   18150 use strict;
  6         14  
  6         207  
3 6     6   28 use warnings;
  6         10  
  6         138  
4            
5 6     6   2573 use File::Rename; # REQUIRE_ORDER
  6         12  
  6         31  
6 6     6   3984 use Pod::Usage;
  6         284694  
  6         2281  
7            
8             main() unless caller;
9            
10             sub main {
11 10 50   10   24769 my $options = File::Rename::Options::GetOptions()
12             or pod2usage;
13            
14 10 50       35 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       29 mod_version() if $options->{show_version};
23 9 50       21 pod2usage( -verbose => 2 ) if $options->{show_manual};
24 9 50       28 pod2usage( -exitval => 1 ) if $options->{show_help};
25            
26 9 50       57 @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;
  0         0  
27            
28 9         68 File::Rename::rename(\@ARGV, $options);
29             }
30            
31             sub mod_version {
32 1     1   3 print __FILE__;
33 1         15 my $version = File::Rename->VERSION;
34 1         12 my $opt_ver = File::Rename::Options->VERSION;
35 1         3 print ' using File::Rename version '. $version;
36 1 50       42 if( (eval $opt_ver) < (eval $version) ) {
37 1 50       3 $opt_ver .= '.00' unless $opt_ver =~ m{\.};
38 1         4 print ', File::Rename::Options version '. $opt_ver;
39             }
40             # ignore File::Rename->VERSION
41 1         2 print "\n\n";
42 1         117 exit 0
43             }
44            
45             1;
46            
47             __END__