| 1 | package File::Rename::Options; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 15 | ▶ | BEGIN { eval { require warnings; warnings->import } } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 15 | ▶ | use Getopt::Long (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | $VERSION = '1.10'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 15 | eval{ Getopt::Long::Configure qw( | |||||||||||||||||||||||||||||||||||||||||
| 12 | posix_default | ||||||||||||||||||||||||||||||||||||||||||
| 13 | no_ignore_case | ||||||||||||||||||||||||||||||||||||||||||
| 14 | no_require_order | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 15 | ▶ | ); 1 } or do { require Carp; Carp::carp($@) }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | sub GetOptions { | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 19 | ▶ | my ($no_code) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetOptions: called CC=8 SCAR=21.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 19 | my @expression; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 19 | my $fullpath = 1; | |||||||||||||||||||||||||||||||||||||||||
| 21 | Getopt::Long::GetOptions( | ||||||||||||||||||||||||||||||||||||||||||
| 22 | '-v|verbose' => \my $verbose, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | '-0|null' => \my $null, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | '-n|nono' => \my $nono, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | '-f|force' => \my $force, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | '-h|?|help' => \my $help, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | '-m|man' => \my $man, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | '-V|version' => \my $version, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ▶ | '-d|filename' => sub { undef $fullpath }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | '-path|fullpath!' => \$fullpath, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | '-e=s' => \@expression, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | '-E=s' => | ||||||||||||||||||||||||||||||||||||||||||
| 33 | sub { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | ▶ | my(undef, $e) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | $e .= ';'; | |||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | push @expression, $e; | |||||||||||||||||||||||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 19 | ▶ | '-u|unicode:s' => \my $unicode, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | ) or return; | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 19 | my $options = { | |||||||||||||||||||||||||||||||||||||||||
| 42 | verbose => $verbose, | ||||||||||||||||||||||||||||||||||||||||||
| 43 | input_null => $null, | ||||||||||||||||||||||||||||||||||||||||||
| 44 | no_action => $nono, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | over_write => $force, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | filename_only => !$fullpath, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | show_help => $help, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | show_manual => $man, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | show_version => $version, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | unicode_strings => defined $unicode, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | encoding => $unicode, | ||||||||||||||||||||||||||||||||||||||||||
| 52 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 19 | ▶ | return $options if $no_code; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 13 | ▶ | return $options if $help or $man or $version; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$help or $man or $version
$help or $man
MC/DC33%1/3
$help or $man or $version
$help
$man
$version
Truth table50%2/4
A or B or C
A= $helpB= $manC= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 12 | ▶ | if( @expression ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | $options->{_code} = join "\n", @expression; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 8 | ▶ | return unless @ARGV; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 8 | $options->{_code} = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 12 | return $options; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | sub bad_encoding { | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 11 | ▶ | my $options = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bad_encoding: called CC=3 SCAR=15.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 11 | my $encoding = $options->{encoding}; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 11 | ▶ | return unless $encoding; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | return unless $encoding =~ /[^\s\w.-]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return 1 | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||||||||||||||||