line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Rename::Options;
|
2
|
21
|
|
|
21
|
|
73893
|
use strict;
|
|
21
|
|
|
|
|
52
|
|
|
21
|
|
|
|
|
739
|
|
3
|
21
|
|
|
21
|
|
105
|
use warnings;
|
|
21
|
|
|
|
|
139
|
|
|
21
|
|
|
|
|
657
|
|
4
|
|
|
|
|
|
|
|
5
|
21
|
|
|
21
|
|
15988
|
use Getopt::Long 2.24 ();
|
|
21
|
|
|
|
|
245982
|
|
|
21
|
|
|
|
|
10826
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 2.00;
|
8
|
|
|
|
|
|
|
our $IMPORTED;
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import {
|
11
|
21
|
|
|
21
|
|
71
|
my $pack = shift;
|
12
|
21
|
50
|
|
|
|
106
|
if( $IMPORTED++ ) {
|
13
|
0
|
|
|
|
|
0
|
require Carp;
|
14
|
0
|
|
|
|
|
0
|
Carp::cluck("$pack->import() called twice");
|
15
|
|
|
|
|
|
|
}
|
16
|
21
|
|
|
|
|
63
|
my @config = qw(
|
17
|
|
|
|
|
|
|
posix_default
|
18
|
|
|
|
|
|
|
no_ignore_case
|
19
|
|
|
|
|
|
|
);
|
20
|
21
|
|
|
|
|
49
|
push @config, @_;
|
21
|
21
|
|
|
|
|
75
|
Getopt::Long::Configure(@config);
|
22
|
|
|
|
|
|
|
}
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub GetOptions {
|
25
|
29
|
|
|
29
|
1
|
25489
|
my ($no_code) = @_;
|
26
|
29
|
|
|
|
|
65
|
my @expression;
|
27
|
29
|
|
|
|
|
66
|
my $fullpath = 1;
|
28
|
|
|
|
|
|
|
Getopt::Long::GetOptions(
|
29
|
|
|
|
|
|
|
'-v|verbose' => \my $verbose,
|
30
|
|
|
|
|
|
|
'-0|null' => \my $null,
|
31
|
|
|
|
|
|
|
'-n|nono' => \my $nono,
|
32
|
|
|
|
|
|
|
'-f|force' => \my $force,
|
33
|
|
|
|
|
|
|
'-h|?|help' => \my $help,
|
34
|
|
|
|
|
|
|
'-m|man' => \my $man,
|
35
|
|
|
|
|
|
|
'-V|version' => \my $version,
|
36
|
4
|
|
|
4
|
|
3649
|
'-d|filename' => sub { undef $fullpath },
|
37
|
|
|
|
|
|
|
'-path|fullpath!' => \$fullpath,
|
38
|
|
|
|
|
|
|
'-e=s' => \@expression,
|
39
|
|
|
|
|
|
|
'-E=s' =>
|
40
|
|
|
|
|
|
|
sub {
|
41
|
8
|
|
|
8
|
|
4247
|
my(undef, $e) = @_;
|
42
|
8
|
|
|
|
|
23
|
$e .= ';';
|
43
|
8
|
|
|
|
|
26
|
push @expression, $e;
|
44
|
|
|
|
|
|
|
},
|
45
|
29
|
50
|
|
|
|
686
|
'-u|unicode:s' => \my $unicode,
|
46
|
|
|
|
|
|
|
) or return;
|
47
|
|
|
|
|
|
|
|
48
|
29
|
|
|
|
|
23556
|
my $options = {
|
49
|
|
|
|
|
|
|
verbose => $verbose,
|
50
|
|
|
|
|
|
|
input_null => $null,
|
51
|
|
|
|
|
|
|
no_action => $nono,
|
52
|
|
|
|
|
|
|
over_write => $force,
|
53
|
|
|
|
|
|
|
filename_only => !$fullpath,
|
54
|
|
|
|
|
|
|
show_help => $help,
|
55
|
|
|
|
|
|
|
show_manual => $man,
|
56
|
|
|
|
|
|
|
show_version => $version,
|
57
|
|
|
|
|
|
|
unicode_strings => defined $unicode,
|
58
|
|
|
|
|
|
|
encoding => $unicode,
|
59
|
|
|
|
|
|
|
};
|
60
|
29
|
100
|
|
|
|
161
|
return $options if $no_code;
|
61
|
23
|
100
|
33
|
|
|
263
|
return $options if $help or $man or $version;
|
|
|
|
66
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
21
|
100
|
|
|
|
86
|
if( @expression ) {
|
64
|
7
|
|
|
|
|
33
|
$options->{_code} = join "\n", @expression;
|
65
|
|
|
|
|
|
|
}
|
66
|
|
|
|
|
|
|
else {
|
67
|
14
|
50
|
|
|
|
58
|
return unless @ARGV;
|
68
|
14
|
|
|
|
|
70
|
$options->{_code} = shift @ARGV;
|
69
|
|
|
|
|
|
|
}
|
70
|
21
|
|
|
|
|
136
|
return $options;
|
71
|
|
|
|
|
|
|
}
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub bad_encoding {
|
74
|
21
|
|
|
21
|
1
|
48
|
my $options = shift;
|
75
|
21
|
|
|
|
|
71
|
my $encoding = $options->{encoding};
|
76
|
21
|
50
|
|
|
|
107
|
return unless $encoding;
|
77
|
0
|
0
|
|
|
|
|
return unless $encoding =~ /[^\s\w.-]/;
|
78
|
0
|
|
|
|
|
|
return 1
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1;
|
82
|
|
|
|
|
|
|
__END__
|