| 1 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package Rex::Args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 109 | ▶ | use v5.14.4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 109 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 109 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 109 | ▶ | use vars qw(%rex_opts); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 109 | ▶ | use Rex::Logger; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 109 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 109 | our $CLEANUP = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | sub args_spec { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
args_spec: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | a => {}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | C => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | c => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | q => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | Q => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | F => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | T => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | h => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | v => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | d => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | s => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | m => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | y => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | w => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | S => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | E => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | o => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | f => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | M => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | b => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | e => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | H => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | u => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | p => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | P => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | K => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | G => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | g => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | z => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | O => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | t => { type => "string" }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | sub parse_rex_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_rex_opts: called CC=20 SCAR=32.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | my %args = $class->args_spec; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | #### clean up @ARGV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | my $runner = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | for (@ARGV) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 17 | ▶ | if ( /^\-[A-Za-z]+/ && length($_) > 2 && $CLEANUP ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
/^\-[A-Za-z]+/u and length $_ > 2 and $Rex::Args::CLEANUP
/^\-[A-Za-z]+/u and length $_ > 2
MC/DC66%2/3
/^\-[A-Za-z]+/u and length $_ > 2 and $Rex::Args::CLEANUP
/^\-[A-Za-z]+/u
length $_ > 2
$Rex::Args::CLEANUP
Truth table75%3/4
A and B and C
A= /^\-[A-Za-z]+/uB= length $_ > 2C= $Rex::Args::CLEANUP
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 1 | my @args = map { "-$_" } split( //, substr( $_, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 1 | splice( @ARGV, $runner, 1, @args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 17 | $runner++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | #### parse rex options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 1 | my @params = @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1 | for my $p (@params) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # shift off @ARGV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 10 | my $shift = shift @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 10 | ▶ | if ( length($p) >= 2 && substr( $p, 0, 1 ) eq "-" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
length $p >= 2 and substr($p, 0, 1) eq "-"
MC/DC50%1/2
length $p >= 2 and substr($p, 0, 1) eq "-"
length $p >= 2
substr($p, 0, 1) eq "-"
Truth table66%2/3
A and B
A= length $p >= 2B= substr($p, 0, 1) eq "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 9 | my $name_param = substr( $p, 1, 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # found a parameter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | ▶ | if ( exists $args{$name_param} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | Rex::Logger::debug("Option found: $name_param ($p)"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 9 | my $type = "Single"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 9 | ▶ | if ( exists $args{$name_param}->{type} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 5 | $type = $args{$name_param}->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 5 | Rex::Logger::debug(" is a $type"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 5 | shift @params; # remove the next parameter, because it must be an option | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 5 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not exists $ARGV[0] or length $ARGV[0] == 2 and exists $args{substr $ARGV[0], 1, 2} and substr($ARGV[0], 0, 1) eq "-"
length $ARGV[0] == 2 and exists $args{substr $ARGV[0], 1, 2} and substr($ARGV[0], 0, 1) eq "-"
length $ARGV[0] == 2 and exists $args{substr $ARGV[0], 1, 2}
MC/DC0%0/4
not exists $ARGV[0] or length $ARGV[0] == 2 and exists $args{substr $ARGV[0], 1, 2} and substr($ARGV[0], 0, 1) eq "-"
not exists $ARGV[0]
length $ARGV[0] == 2
exists $args{substr $ARGV[0], 1, 2}
substr($ARGV[0], 0, 1) eq "-"
Truth table20%1/5
not(A) or B and C and D
A= not exists $ARGV[0]B= length $ARGV[0] == 2C= exists $args{substr $ARGV[0], 1, 2}D= substr($ARGV[0], 0, 1) eq "-"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | !exists $ARGV[0] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | || ( length( $ARGV[0] ) == 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | && exists $args{ substr( $ARGV[0], 1, 2 ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | && substr( $ARGV[0], 0, 1 ) eq "-" ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # this is a typed parameter without an option! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | Rex::Logger::debug(" but there is no parameter"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | Rex::Logger::debug( Dumper( \@params ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | print("No parameter for $name_param\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | CORE::exit 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | elsif ( exists $args{$name_param}->{func} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | Rex::Logger::debug(" is a function - executing now"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $args{$name_param}->{func}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 9 | my $c = "Rex::Args::\u$type"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 9 | ▶ | eval "use $c"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 9 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | die("No Argumentclass $type found!"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 9 | ▶ | if ( exists $rex_opts{$name_param} && $type eq "Single" ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $Rex::Args::rex_opts{$name_param} and $type eq "Single"
MC/DC0%0/2
exists $Rex::Args::rex_opts{$name_param} and $type eq "Single"
exists $Rex::Args::rex_opts{$name_param}
$type eq "Single"
Truth table66%2/3
A and B
A= exists $Rex::Args::rex_opts{$name_param}B= $type eq "Single"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $rex_opts{$name_param}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # multiple params defined, create an array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 9 | ▶ | if ( exists $rex_opts{$name_param} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | ▶ | if ( !ref $rex_opts{$name_param} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | $rex_opts{$name_param} = [ $rex_opts{$name_param} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | push @{ $rex_opts{$name_param} }, $c->get; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 8 | $rex_opts{$name_param} = $c->get; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | Rex::Logger::debug("Option not known: $name_param ($p)"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # unshift the last parameter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | unshift @ARGV, $shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 224 | ▶ | sub getopts { return %rex_opts; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getopts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 65 | ▶ | sub is_opt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_opt: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 65 | my ( $class, $opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 65 | ▶ | if ( exists $rex_opts{$opt} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return $rex_opts{$opt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 16 | ▶ | sub get { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 16 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 16 | my $task = Rex::TaskList->create->current_task; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 16 | ▶ | if ($task) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 13 | return $task->get_opts(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 3 | return _read_old_way(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | ▶ | sub _read_old_way { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_old_way: called CC=3 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | #### parse task options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 3 | my %task_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 3 | for my $p (@ARGV) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | my ( $key, $val ) = split( /=/, $p, 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $key =~ s/^--//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | if ( defined $val ) { $task_opts{$key} = $val; next; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $task_opts{$key} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 3 | return %task_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 109 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||