| 1 | |||||||||||||||||||||||||||||
| 2 | package App::Asciio ; | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 4 | $|++ ; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Data::TreeDumper ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Getopt::Long ; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub ParseSwitches | ||||||||||||||||||||||||||||
| 15 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
ParseSwitches: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 0 | my ($self, $switches_to_parse, $ignore_error) = @_ ; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | my $asciio_config = {} ; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | Getopt::Long::Configure('no_auto_abbrev', 'no_ignore_case', 'require_order') ; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | my @flags = Get_GetoptLong_Data($asciio_config) ; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | @ARGV = @{$switches_to_parse} ; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # tweek option parsing so we can mix switches with targets | ||||||||||||||||||||||||||||
| 27 | 0 | my $contains_switch ; | |||||||||||||||||||||||||||
| 28 | my @targets ; | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | do | ||||||||||||||||||||||||||||
| 31 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | while(@ARGV && $ARGV[0] !~ /^-/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@ARGV and not $ARGV[0] =~ /^-/
MC/DC0%0/2
@ARGV and not $ARGV[0] =~ /^-/
@ARGV
not $ARGV[0] =~ /^-/
Truth table0%0/3
A and not(B)
A= @ARGVB= not $ARGV[0] =~ /^-/
| |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||
| 34 | #~ print "target => $ARGV[0] \n" ; | ||||||||||||||||||||||||||||
| 35 | 0 | push @targets, shift @ARGV ; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | $contains_switch = @ARGV ; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | local $SIG{__WARN__} = sub {print STDERR $_[0] unless $ignore_error ;} ; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | unless(GetOptions(@flags)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return(0, "Try perl asciio -h.", $asciio_config, @ARGV) unless $ignore_error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | while($contains_switch) ; | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | $asciio_config->{TARGETS} = \@targets ; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | return(1, '', $asciio_config) ; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | sub Get_GetoptLong_Data | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
Get_GetoptLong_Data: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | my $asciio_config = shift || die 'Missing argument.' ; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || die('Missing argument.')
MC/DC0%0/1
shift() || die('Missing argument.')
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | my @flags_and_help = GetSwitches($asciio_config) ; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | my $flag_element_counter = 0 ; | |||||||||||||||||||||||||||
| 63 | 0 | my @getoptlong_data ; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | for (my $i = 0 ; $i < @flags_and_help; $i += 4) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 0 | my ($flag, $variable) = ($flags_and_help[$i], $flags_and_help[$i + 1]) ; | |||||||||||||||||||||||||||
| 68 | 0 | push @getoptlong_data, ($flag, $variable) ; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | return(@getoptlong_data) ; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub GetSwitches | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
GetSwitches: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my $asciio_config = shift || {} ; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | $asciio_config->{SETUP_PATHS} = [] ; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | my @flags_and_help = | ||||||||||||||||||||||||||||
| 83 | ( | ||||||||||||||||||||||||||||
| 84 | 'setup_path=s' => $asciio_config->{SETUP_PATHS}, | ||||||||||||||||||||||||||||
| 85 | 'Sets the root of the setup directory.', | ||||||||||||||||||||||||||||
| 86 | '', | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 's|script=s' => \$asciio_config->{SCRIPT}, | ||||||||||||||||||||||||||||
| 89 | 'script to be run at AsciiO start.', | ||||||||||||||||||||||||||||
| 90 | '', | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 'h|help' => \$asciio_config->{HELP}, | ||||||||||||||||||||||||||||
| 93 | 0 | 'Displays some help.', | |||||||||||||||||||||||||||
| 94 | '', | ||||||||||||||||||||||||||||
| 95 | ) ; | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | return(@flags_and_help) ; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 4 | 1 ; | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||