| 1 | package Proc::ShellSubset::Large; # The large subset (doc/large-subset/large-subset-spec.md): Proc::ShellSubset, and where it rejects, a wider grammar | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 484 | our $VERSION = '0.11'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 484 | ▶ | use strict; use warnings; use Proc::ShellSubset; use List::Util qw(pairs pairvalues); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Proc::ShellSubset::Large::parse($string, %opt) returns a List, or { error, pos, last, tree } as Proc::ShellSubset::parse does. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # It first asks Proc::ShellSubset (with if while for case read assign param_ops on); only if that rejects the string does | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # it parse it again by the large grammar: Proc::ShellSubset's own code with some of its subs and tables replaced for the | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # time of the parse. %opt: as for Proc::ShellSubset, except brace (dropped: brace expansion is bash only). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # Tree, in addition to Proc::ShellSubset's (keys only when non-empty): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Command = { func => NAME, body => Command } f() { ...; } and the like, with the body's redir | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # | { export => [NAME, Word or undef, ...] } | { readonly => [...] } | { local => [NAME, Word, ...] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # | { exec => 1, redir => [Redir, ...] } exec with redirections only | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # | { argv => [], redir => [...] } redirections alone (> file) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # | { set => [...], redir => [...] } settings with redirections (no $ or ` in them): redirect, then set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # | { argv => [...], ... }: argv->[0] may now be a Word with expansions; exec => 1 may stand anywhere | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # Redir = [ fd, '<<', Word ] a here-document: the Word is its body (tabs already removed for <<-); no splitting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Part = [ '$', N ] and [ '${', N, OP, Word ] also for N = 0-9, @ * # $ (and 10... braced) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # | [ '${', NAME, OP, Word ] OP also = := ? :? % %% # ## (in a % or # Word, ['*', ...] parts are pattern) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # | [ "'", 'text' ] quoted text in the Word of an unquoted ${x:-word}: not split | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # $((...)) text may hold assignments (= += ... >>=) and $1, ${10}, $#, $$ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 484 | my @OPTS = qw(if while for case read assign param_ops); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1416 | ▶ | sub parse { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=9 SCAR=22.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1416 | my ($s, %o) = @_; delete $o{brace}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1416 | ▶ | return { error => '/dev/tcp or /dev/udp (bash opens a socket)', pos => $-[0], last => 0, tree => [] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | if $s =~ m{[<>]&?[ \t]*["']?/dev/(?:tcp|udp)/}; # before Proc::ShellSubset too, which takes it for a file | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1414 | ▶ | my $al = $s =~ /(?:^|[\s;&|(])alias\s/ || %{$o{aliases} // {}}; # B1: aliases are expanded by the large grammar only | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
$s =~ /(?:^|[\s;&|(])alias\s/ || %{$o{'aliases'} // {};}
$o{"aliases"} // {}
MC/DC100%2/2
$s =~ /(?:^|[\s;&|(])alias\s/ || %{$o{'aliases'} // {};}
$s =~ /(?:^|[\s;&|(])alias\s/
%{$o{'aliases'} // {};}
MC/DC100%1/1
$o{"aliases"} // {}
$o{"aliases"}
Truth table100%3/3
A || B
A= $s =~ /(?:^|[\s;&|(])alias\s/B= %{$o{'aliases'} // {};}
Truth table100%2/2
A
A= $o{"aliases"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1414 | ▶ | my $t = $al ? { error => '' } : Proc::ShellSubset::parse($s, %o, map +($_ => 1), @OPTS); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1414 | ▶ | $t = Proc::ShellSubset::large($s, %o, map +($_ => 1), @OPTS) if ref $t eq 'HASH' && $t->{error} !~ /^starts with - or \+/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $t eq "HASH" and not $t->{"error"} =~ /^starts with - or \+/
MC/DC100%2/2
ref $t eq "HASH" and not $t->{"error"} =~ /^starts with - or \+/
ref $t eq "HASH"
not $t->{"error"} =~ /^starts with - or \+/
Truth table100%3/3
A and not(B)
A= ref $t eq "HASH"B= not $t->{"error"} =~ /^starts with - or \+/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1414 | ▶ | my $why = ref $t eq 'ARRAY' && treecheck($t, \%o); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
ref $t eq 'ARRAY' && treecheck($t, \%o)
MC/DC100%2/2
ref $t eq 'ARRAY' && treecheck($t, \%o)
ref $t eq 'ARRAY'
treecheck($t, \%o)
Truth table100%3/3
A && B
A= ref $t eq 'ARRAY'B= treecheck($t, \%o)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1414 | ▶ | $why ? { error => $why, pos => 0, last => 0, tree => [] } : $t } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 950 | ▶ | sub treecheck { # rules for commands the base grammar accepts too: each argv with a literal name and a check (Q1: kill) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
treecheck: called CC=11 SCAR=24.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 950 | ▶ | my @todo = (shift); local %Proc::ShellSubset::O = %{shift // {}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // {}
MC/DC0%0/1
shift() // {}
shift()
Truth table50%1/2
A
A= shift()
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 950 | ▶ | while (@todo) { my $x = shift @todo; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 21541 | ▶ | if (ref $x eq 'ARRAY') { push @todo, @$x } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | elsif (ref $x eq 'HASH') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 2625 | ▶ | if (ref $x->{argv} eq 'ARRAY' && @{$x->{argv}} && !ref $x->{argv}[0] && !$x->{fn} and my $c = $Proc::ShellSubset::TREECHK{$x->{argv}[0]}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%12/12
ref $x->{"argv"} eq "ARRAY" and @{$x->{"argv"};} and not ref $x->{"argv"}[0] and not $x->{"fn"} and my $c = $Proc::ShellSubset::TREECHK{$x->{"argv"}[0]}
ref $x->{"argv"} eq "ARRAY" and @{$x->{"argv"};} and not ref $x->{"argv"}[0] and not $x->{"fn"}
ref $x->{"argv"} eq "ARRAY" and @{$x->{"argv"};} and not ref $x->{"argv"}[0]
ref $x->{"argv"} eq "ARRAY" and @{$x->{"argv"};}
MC/DC100%5/5
ref $x->{"argv"} eq "ARRAY" and @{$x->{"argv"};} and not ref $x->{"argv"}[0] and not $x->{"fn"} and my $c = $Proc::ShellSubset::TREECHK{$x->{"argv"}[0]}
ref $x->{"argv"} eq "ARRAY"
@{$x->{"argv"};}
not ref $x->{"argv"}[0]
not $x->{"fn"}
my $c = $Proc::ShellSubset::TREECHK{$x->{"argv"}[0]}
Truth table100%6/6
A and B and not(C) and not(D) and E
A= ref $x->{"argv"} eq "ARRAY"B= @{$x->{"argv"};}C= not ref $x->{"argv"}[0]D= not $x->{"fn"}E= my $c = $Proc::ShellSubset::TREECHK{$x->{"argv"}[0]}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 130 | ▶ | my $why = $c->(@{$x->{argv}}[1 .. $#{$x->{argv}}]); return $why if $why } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 2609 | push @todo, values %$x } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 934 | '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | package # hidden from the PAUSE indexer: the module Proc::ShellSubset lives in lib/Proc/ShellSubset.pm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Proc::ShellSubset; # the replacements run inside Proc::ShellSubset, with its variables | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 484 | our (%O, $M, @OPEN, $ATT, $LAST, $LOOP, $FORALL, $RLIT, %KW, %BI, %SH, $NM, $END, $B, $BN, %EX, $PIECE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 484 | our ($FUNC, @HD, $AP, $NOAT, %LOC, %UNSET) = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 484 | our ($SUBLOOP, $LN, $SRC, $LOFF, $CUT, @ASH) = (0, 0, '', 0, 0); # loops around the subshell we are in (they end it: break, continue as dash, rule E); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # whether $LINENO is used here, and the text, for line numbers (G8, rule E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 15 | ▶ | sub lineof { $LOFF + 1 + (substr($SRC, 0, opos(shift)) =~ tr/\n//) } # LOFF: lines before this text (the rest of a text, P1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
lineof: called CC=1 SCAR=0.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 484 | our %FDEF; # 3A (post-0.04): names this text defines as functions somewhere; commands by these names are left | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # to run time, where a function defined by then comes before the builtin (POSIX order) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 484 | our (%ALIAS, @AEXP, $ANEXT); # B1: alias name -> [[position from which it holds, value or undef], ...] in this text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # aliases being expanded [name, end position]; where the word after an alias whose value ends in a blank starts # depth of function bodies; here-document bodies not yet used; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # position of the command; true where "$@" would join with IFS (dash) or blanks (bash); names made local; unset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 484 | my ($o_command, $o_word, $o_bq, $o_shell) = (\&command, \&word, \&bq, \&shell); # the originals, called by the replacements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 484 | our $TILDEPW; # G16: true while the large grammar parses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 484 | my @INTER = qw(history fc bind help compopt logout); # B2: interactive only; caller's option interactive => reject|nop|dash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 484 | my %LBI = map +($_ => 1), qw(chdir source let declare typeset shopt enable builtin caller dirs pushd popd disown | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | mapfile readarray suspend compgen complete), @INTER; # builtins the large subset still leaves to sh | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 484 | my %OWN = map +($_ => 1), qw(: . break cd command continue eval exec exit export getopts local read readonly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | return set shift trap umask unset wait alias unalias jobs fg bg hash type times ulimit), @INTER; # builtins it runs itself | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 484 | my %NOFN = map +($_ => 1), qw(break continue eval exec exit export readonly return set shift times trap unset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | local source alias unalias); # no function by these names: special builtins (dash: also local, bash: source); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # alias, unalias: aliases are a parse-time matter here (B1), so a call must be known to be the builtin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 484 | our %REGBI = map +($_ => 1), qw(cd getopts read umask wait jobs fg bg hash type ulimit); # regular builtins we run, which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # 'command NAME' and a not-yet-defined function by that name reach at run time (3A, post-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 484 | my %TS = map +($_ => 1), qw(0 EXIT HUP INT QUIT ABRT FPE KILL PIPE ALRM TERM USR1 USR2 STOP); # trap signals: names in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 484 | my %SIGN; { require Config; my @n = split ' ', $Config::Config{sig_name}; my @v = split ' ', $Config::Config{sig_num}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 484 | @SIGN{@v} = @n; $SIGN{0} = 'EXIT' } # any case, or their numbers here (P6); KILL and STOP: nothing to do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 68 | ▶ | sub trapsig { my $s = shift; $TS{$s =~ /^[0-9]+\z/ ? $SIGN{$s} // '' : uc $s} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
trapsig: called CC=3 SCAR=11.0
Pod
undocumented
Branch: 1 branch
Condition100%2/2
$SIGN{$s} // ""
MC/DC100%1/1
$SIGN{$s} // ""
$SIGN{$s}
Truth table100%2/2
A
A= $SIGN{$s}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 484 | my %SETO = map +($_ => 1), qw(errexit nounset noglob noclobber allexport ignoreeof notify nolog); # the last three do nothing (P6) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 484 | my $PN = qr/$NM|[0-9]+|[?!#\$@*]/; # what ${...} may name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 484 | my $DELIM = qr/(?:'[^']*'|"(?:[^"\\]|\\.)*"|\\.|[^ \t\n;&|()<>'"\\`])+/s; # a here-document delimiter as written | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 484 | my $ARITH = qr{(?(DEFINE) # $((...)) with assignments (F10) and positional parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | (?<w> [ \t\n]* ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | (?<num> (?: 0[xX][0-9a-fA-F]+ | 0[0-7]* | [1-9][0-9]* ) (?![0-9A-Za-z_]) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | (?<v> \$? [A-Za-z_][A-Za-z0-9_]* | \$\{ (?: [A-Za-z_][A-Za-z0-9_]* | [0-9]+ | [?!#\$] ) \} | \$[0-9?!#\$] ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | (?<atom> (?&w) (?: [-+!~] (?&w) )* (?: (?&num) | (?&v) | \( (?&e) (?&w) \) ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | (?<op> (?&w) (?: << | >> | <= | >= | == | != | && | \|\| | [-+*/%<>&^|] ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | (?<c> (?&atom) (?: (?&op) (?&atom) )* (?: (?&w) \? (?&e) (?&w) : (?&c) )? ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | (?<e> (?&w) [A-Za-z_][A-Za-z0-9_]* (?&w) (?: << | >> | [-+*/%&^|] )? = (?!=) (?&e) | (?&c) ) )}x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 484 | my $LPIECE = do { # Proc::ShellSubset's $PIECE, with '{' and '}' literal where no brace expansion can start (P1): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 484 | my $x = "$PIECE"; # '}' always; '{' when its '}' has no ',' and no '..' inside, or when no '}' follows in the word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 484 | my ($lb, $def) = split /^----\n/m, <<'RE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | (?<lit> \\ \z | \x7b (?= (?&bal) \x7d ) | \x7b (?! [^ \t\n;&|()<>]* \x7d ) | \x7d ) | | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ---- | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | (?(DEFINE) (?<bal> (?: [^\x7b\x7d,. \t\n;&|()<>'"\\`\$] | \.(?!\.) | \\. | '[^']*' | "(?:[^"\\]|\\.)*" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | | \$(?![\x7b(]) | \x7b (?&bal) \x7d )* ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | RE | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 484 | ▶ | my $i = index $x, '(?<cb>'; $i > 0 && $x =~ /\)\z/ or die 'P1: $PIECE changed'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$i > 0 and $x =~ /\)\z/
MC/DC0%0/2
$i > 0 and $x =~ /\)\z/
$i > 0
$x =~ /\)\z/
Truth table33%1/3
A and B
A= $i > 0B= $x =~ /\)\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 484 | substr($x, -1, 0) = $def; substr($x, $i, 0) = $lb; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 484 | qr/$x/ }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 484 | my %SETOK = map +($_ => 1), qw(PS1 PS4 HOSTNAME PIPESTATUS BASH); # shell-set names both shells let a string set (P3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 484 | our %TREECHK; # checks applied to the whole tree, also where the base grammar accepted the string (see Large::treecheck) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # P5: [ and test are the program (coreutils), which decides every form; R1: except a literal < or > argument, which both | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # shells take as a string comparison and the program refuses. Rule F (the user, 2026-11-03; post2-0.04): where the program | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # is wrong, we may do better: 's1 < s2' and 's1 > s2' alone (also after '!') are compared by the executor itself, by bytes as | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # both shells (POSIX 2024 adds them); other forms with < or > stay rejected unless the caller sets the option test_lt_gt. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 484 | my $TOP = qr/^(?:!?=|==|<|>|-(?:eq|ne|lt|le|gt|ge|nt|ot|ef|a|o)|!|\()\z/; # what may stand before an operand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 52 | ▶ | $TREECHK{$_} = sub { my @a = @_; pop @a if @a && !ref $a[-1] && $a[-1] eq ']'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=27.9
Branch: 1 branch
Condition83%5/6
@a and not ref $a[-1] and $a[-1] eq "]"
@a and not ref $a[-1]
MC/DC66%2/3
@a and not ref $a[-1] and $a[-1] eq "]"
@a
not ref $a[-1]
$a[-1] eq "]"
Truth table75%3/4
A and not(B) and C
A= @aB= not ref $a[-1]C= $a[-1] eq "]"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 52 | ▶ | return '' if $O{test_lt_gt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 50 | ▶ | my @o = $a[0] && !ref $a[0] && $a[0] eq '!' ? @a[1 .. $#a] : @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$a[0] and not ref $a[0] and $a[0] eq "!"
$a[0] and not ref $a[0]
MC/DC100%3/3
$a[0] and not ref $a[0] and $a[0] eq "!"
$a[0]
not ref $a[0]
$a[0] eq "!"
Truth table100%4/4
A and not(B) and C
A= $a[0]B= not ref $a[0]C= $a[0] eq "!"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 50 | ▶ | return '' if @o == 3 && !ref $o[1] && $o[1] =~ /^[<>]\z/; # rule F: the executor compares (Proc::ShellSpawn::Large::b_test) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@o == 3 and not ref $o[1] and $o[1] =~ /^[<>]\z/
@o == 3 and not ref $o[1]
MC/DC66%2/3
@o == 3 and not ref $o[1] and $o[1] =~ /^[<>]\z/
@o == 3
not ref $o[1]
$o[1] =~ /^[<>]\z/
Truth table75%3/4
A and not(B) and C
A= @o == 3B= not ref $o[1]C= $o[1] =~ /^[<>]\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 40 | ▶ | for my $i (1 .. $#a - 1) { next if ref $a[$i] || $a[$i] !~ /^[<>]\z/ || !ref $a[$i - 1] && $a[$i - 1] =~ $TOP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
ref $a[$i] or not $a[$i] =~ /^[<>]\z/ or not ref $a[$i - 1] and $a[$i - 1] =~ /$TOP/
ref $a[$i] or not $a[$i] =~ /^[<>]\z/
not ref $a[$i - 1] and $a[$i - 1] =~ /$TOP/
MC/DC25%1/4
ref $a[$i] or not $a[$i] =~ /^[<>]\z/ or not ref $a[$i - 1] and $a[$i - 1] =~ /$TOP/
ref $a[$i]
not $a[$i] =~ /^[<>]\z/
not ref $a[$i - 1]
$a[$i - 1] =~ /$TOP/
Truth table60%3/5
A or not(B) or not(C) and D
A= ref $a[$i]B= not $a[$i] =~ /^[<>]\z/C= not ref $a[$i - 1]D= $a[$i - 1] =~ /$TOP/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 4 | return "'$a[$i]' between two operands in '[' or 'test' (both shells compare strings, the program [ refuses; option test_lt_gt)" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 36 | '' } for '[', 'test'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 11 | ▶ | sub status { @_ > 1 || @_ && !ref $_[0] && ($_[0] !~ /^(?:0|[1-9][0-9]{0,2})\z/ || $_[0] > 255) ? 'unsupported exit status' : '' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status: called CC=6 SCAR=18.4
Pod
undocumented
Branch: 1 branch
Condition75%9/12
@_ > 1 or @_ and not ref $_[0] and !($_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $_[0] > 255
@_ and not ref $_[0] and !($_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $_[0] > 255
@_ and not ref $_[0]
not $_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/ or $_[0] > 255
MC/DC40%2/5
@_ > 1 or @_ and not ref $_[0] and !($_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/) || $_[0] > 255
@_ > 1
@_
not ref $_[0]
not $_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/
$_[0] > 255
Truth table50%3/6
A or B and not(C) and not(D) or E
A= @_ > 1B= @_C= not ref $_[0]D= not $_[0] =~ /^(?:0|[1-9][0-9]{0,2})\z/E= $_[0] > 255
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 12 | ▶ | sub xstatus { @_ > 1 || @_ && !ref $_[0] && $_[0] !~ /^(?:0|[1-9][0-9]{0,8})\z/ ? 'unsupported exit status' : '' } # exit: modulo 256 (P4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xstatus: called CC=5 SCAR=16.3
Pod
undocumented
Branch: 1 branch
Condition77%7/9
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^(?:0|[1-9][0-9]{0,8})\z/
@_ and not ref $_[0] and not $_[0] =~ /^(?:0|[1-9][0-9]{0,8})\z/
@_ and not ref $_[0]
MC/DC50%2/4
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^(?:0|[1-9][0-9]{0,8})\z/
@_ > 1
@_
not ref $_[0]
not $_[0] =~ /^(?:0|[1-9][0-9]{0,8})\z/
Truth table60%3/5
A or B and not(C) and not(D)
A= @_ > 1B= @_C= not ref $_[0]D= not $_[0] =~ /^(?:0|[1-9][0-9]{0,8})\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | my %CHK = ( # literal arguments of the builtins run by the large subset: (arguments) -> reason to reject, or '' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 7 | ▶ | '.' => sub { @_ == 1 ? '' : "'.' with other than one argument" }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | exit => \&xstatus, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 57 | ▶ | alias => sub { (grep !ref && /=/ && !/^[A-Za-z0-9_.\-]+=/, @_) ? "unsupported 'alias' argument" : '' }, # B1; a word with an | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.3
Branch: 1 branch
Condition83%5/6
!ref($_) && /=/ && !/^[A-Za-z0-9_.\-]+=/
not ref $_ and /=/
MC/DC0%0/3
!ref($_) && /=/ && !/^[A-Za-z0-9_.\-]+=/
not ref $_
/=/
!/^[A-Za-z0-9_.\-]+=/
Truth table75%3/4
not(A) and B && not(C)
A= not ref $_B= /=/C= !/^[A-Za-z0-9_.\-]+=/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | # expansion: P1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 6 | ▶ | unalias => sub { @_ == 1 && !ref $_[0] && $_[0] eq '-a' || @_ && !grep(ref || /^-|=/, @_) ? '' : "unsupported 'unalias' form" }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=25.7
Branch: 1 branch
Condition46%7/15
@_ == 1 and not ref $_[0] and $_[0] eq "-a" or @_ and not grep((ref $_ || /^-|=/), @_)
@_ == 1 and not ref $_[0] and $_[0] eq "-a"
@_ == 1 and not ref $_[0]
@_ and not grep((ref $_ || /^-|=/), @_)
ref $_ || /^-|=/
MC/DC0%0/5
@_ == 1 and not ref $_[0] and $_[0] eq "-a" or @_ and not grep((ref $_ || /^-|=/), @_)
@_ == 1
not ref $_[0]
$_[0] eq "-a"
@_
not grep((ref $_ || /^-|=/), @_)
MC/DC0%0/2
ref $_ || /^-|=/
ref $_
/^-|=/
Truth table20%2/10
A and not(B) and C or D and not(E)
A= @_ == 1B= not ref $_[0]C= $_[0] eq "-a"D= @_E= not grep((ref $_ || /^-|=/), @_)
Truth table33%1/3
A || B
A= ref $_B= /^-|=/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 43 | ▶ | jobs => sub { my @a = @_; shift @a while @a && !ref $a[0] && $a[0] =~ /^-[lp]+\z/; # B3: as dash; -p, -l (rule E); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.0
Branch: 1 branch
Condition83%5/6
@a and not ref $a[0] and $a[0] =~ /^-[lp]+\z/
@a and not ref $a[0]
MC/DC66%2/3
@a and not ref $a[0] and $a[0] =~ /^-[lp]+\z/
@a
not ref $a[0]
$a[0] =~ /^-[lp]+\z/
Truth table75%3/4
A and not(B) and C
A= @aB= not ref $a[0]C= $a[0] =~ /^-[lp]+\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 43 | ▶ | (grep ref || !/^%(?:[1-9][0-9]*|[%+-])\z/, @a) ? "unsupported 'jobs' form" : '' }, # then %N, %%, %+, %- (post-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_ || !/^%(?:[1-9][0-9]*|[%+-])\z/
MC/DC50%1/2
ref $_ || !/^%(?:[1-9][0-9]*|[%+-])\z/
ref $_
!/^%(?:[1-9][0-9]*|[%+-])\z/
Truth table66%2/3
A || not(B)
A= ref $_B= !/^%(?:[1-9][0-9]*|[%+-])\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | ▶ | times => sub { @_ ? "unsupported 'times' form" : '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 12 | ▶ | hash => sub { (grep ref || /^-/ && $_ ne '-r', @_) ? "unsupported 'hash' form" : '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=16.9
Branch: 1 branch
Condition50%3/6
ref $_ || /^-/ && $_ ne '-r'
/^-/ and $_ ne "-r"
MC/DC0%0/3
ref $_ || /^-/ && $_ ne '-r'
ref $_
/^-/
$_ ne "-r"
Truth table50%2/4
A || B and C
A= ref $_B= /^-/C= $_ ne "-r"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 9 | ▶ | type => sub { @_ && !grep(ref || /^-/, @_) ? '' : "unsupported 'type' form" }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=19.1
Branch: 1 branch
Condition33%2/6
@_ and not grep((ref $_ || /^-/), @_)
ref $_ || /^-/
MC/DC0%0/2
@_ and not grep((ref $_ || /^-/), @_)
@_
not grep((ref $_ || /^-/), @_)
MC/DC0%0/2
ref $_ || /^-/
ref $_
/^-/
Truth table33%1/3
A and not(B)
A= @_B= not grep((ref $_ || /^-/), @_)
Truth table33%1/3
A || B
A= ref $_B= /^-/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 20 | ▶ | ulimit => sub { my $r = 0; # reading one limit only: [-H|-S] [-nsctvlmdf] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.4
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 20 | ▶ | for (@_) { return "unsupported 'ulimit' form (only reading a limit)" if ref || !/^-[HS]*[nsctvlmdf]?[HS]*\z/ || /^-\z/; $r += () = /[nsctvlmdf]/g } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref $_ or not /^-[HS]*[nsctvlmdf]?[HS]*\z/ or /^-\z/
ref $_ or not /^-[HS]*[nsctvlmdf]?[HS]*\z/
MC/DC33%1/3
ref $_ or not /^-[HS]*[nsctvlmdf]?[HS]*\z/ or /^-\z/
ref $_
not /^-[HS]*[nsctvlmdf]?[HS]*\z/
/^-\z/
Truth table50%2/4
A or not(B) or C
A= ref $_B= not /^-[HS]*[nsctvlmdf]?[HS]*\z/C= /^-\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 18 | ▶ | $r > 1 ? "unsupported 'ulimit' form (only reading a limit)" : '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 57 | ▶ | kill => ($TREECHK{kill} = sub { my $p = ''; # a signal name with SIG, also -sig...: both shells refuse it, so we do too (Q1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 57 | ▶ | for (@_) { next if ref; return "a 'SIG' signal name for 'kill' (both shells refuse it)" if /^-[Ss][Ii][Gg]/ || $p =~ /^-[sl]\z/ && /^SIG/i; $p = $_ } '' }), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%6/6
/^-[Ss][Ii][Gg]/ or $p =~ /^-[sl]\z/ and /^SIG/i
$p =~ /^-[sl]\z/ and /^SIG/i
MC/DC100%3/3
/^-[Ss][Ii][Gg]/ or $p =~ /^-[sl]\z/ and /^SIG/i
/^-[Ss][Ii][Gg]/
$p =~ /^-[sl]\z/
/^SIG/i
Truth table100%4/4
A or B and C
A= /^-[Ss][Ii][Gg]/B= $p =~ /^-[sl]\z/C= /^SIG/i
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 60 | ▶ | pwd => ($TREECHK{pwd} = sub { # options both shells refuse: we refuse them too (Q1); also where the base grammar accepts it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 60 | ▶ | for (@_) { last if ref($_) || !/^-/ || $_ eq '--'; /^-[LP]+\z/ or return "unsupported 'pwd' option (both shells refuse it)" } '' }), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
ref $_ or not /^-/ or $_ eq "--"
ref $_ or not /^-/
MC/DC66%2/3
ref $_ or not /^-/ or $_ eq "--"
ref $_
not /^-/
$_ eq "--"
Truth table75%3/4
A or not(B) or C
A= ref $_B= not /^-/C= $_ eq "--"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 11 | ▶ | return => sub { &status }, # outside a function: an error, as bash (rule E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 9 | ▶ | shift => sub { @_ > 1 || @_ && !ref $_[0] && $_[0] !~ /^[0-9]+\z/ ? "unsupported 'shift' form" : '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
Branch: 1 branch
Condition88%8/9
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^[0-9]+\z/
@_ and not ref $_[0] and not $_[0] =~ /^[0-9]+\z/
@_ and not ref $_[0]
MC/DC75%3/4
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^[0-9]+\z/
@_ > 1
@_
not ref $_[0]
not $_[0] =~ /^[0-9]+\z/
Truth table80%4/5
A or B and not(C) and not(D)
A= @_ > 1B= @_C= not ref $_[0]D= not $_[0] =~ /^[0-9]+\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 19 | ▶ | wait => sub { (grep !ref && !/^[0-9]+\z/, @_) ? "unsupported 'wait' argument" : '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
Condition100%3/3
ref $_ || /^[0-9]+\z/
MC/DC100%2/2
ref $_ || /^[0-9]+\z/
ref $_
/^[0-9]+\z/
Truth table100%3/3
A || B
A= ref $_B= /^[0-9]+\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 40 | ▶ | umask => sub { @_ > 1 || @_ && !ref $_[0] && $_[0] !~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/ ? "unsupported 'umask' form" : '' }, # -S alone (P4); symbolic (post4-0.03) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.8
Branch: 1 branch
Condition66%6/9
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/
@_ and not ref $_[0] and not $_[0] =~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/
@_ and not ref $_[0]
MC/DC25%1/4
@_ > 1 or @_ and not ref $_[0] and not $_[0] =~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/
@_ > 1
@_
not ref $_[0]
not $_[0] =~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/
Truth table60%3/5
A or B and not(C) and not(D)
A= @_ > 1B= @_C= not ref $_[0]D= not $_[0] =~ /^(?:[0-7]{1,4}|-S|[ugoa]*[-+=][rwx]*(?:,[ugoa]*[-+=][rwx]*)*)\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 48 | ▶ | command => sub { my $f = $_[0] // return q{}; # command alone; command -v NAME; command [-p] PROGRAM ...: no builtin | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=25.1
Condition100%2/2
$_[0] // (return "")
MC/DC100%1/1
$_[0] // (return "")
$_[0]
Truth table100%2/2
A
A= $_[0]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 42 | ▶ | my $dp = $f eq '-p' and shift, $f = $_[0] // return "unsupported 'command' form"; # -p (P4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$_[0] // (return "unsupported 'command' form")
MC/DC0%0/1
$_[0] // (return "unsupported 'command' form")
$_[0]
Truth table50%1/2
A
A= $_[0]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 42 | ▶ | ref $f || $f eq '-v' && @_ == 2 || $f !~ /^-/ && (!$OWN{$f} || $REGBI{$f} && !$dp) && !$LBI{$f} ? '' : "unsupported 'command' form" }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition85%18/21
ref $f or $f eq "-v" and @_ == 2 or not $f =~ /^-/ and !$OWN{$f} || $Proc::ShellSubset::REGBI{$f} && !$dp and not $LBI{$f}
ref $f or $f eq "-v" and @_ == 2
$f eq "-v" and @_ == 2
not $f =~ /^-/ and !$OWN{$f} || $Proc::ShellSubset::REGBI{$f} && !$dp and not $LBI{$f}
not $f =~ /^-/ and !$OWN{$f} || $Proc::ShellSubset::REGBI{$f} && !$dp
not $OWN{$f} or $Proc::ShellSubset::REGBI{$f} and not $dp
$Proc::ShellSubset::REGBI{$f} and not $dp
MC/DC62%5/8
ref $f or $f eq "-v" and @_ == 2 or not $f =~ /^-/ and !$OWN{$f} || $Proc::ShellSubset::REGBI{$f} && !$dp and not $LBI{$f}
ref $f
$f eq "-v"
@_ == 2
not $f =~ /^-/
not $OWN{$f}
$Proc::ShellSubset::REGBI{$f}
not $dp
not $LBI{$f}
Truth table37%6/16
A or B and C or not(D) and not(E) or F and not(G) and not(H)
A= ref $fB= $f eq "-v"C= @_ == 2D= not $f =~ /^-/E= not $OWN{$f}F= $Proc::ShellSubset::REGBI{$f}G= not $dpH= not $LBI{$f}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 23 | ▶ | getopts => sub { @_ < 2 ? "'getopts' without a variable name" : ref $_[1] ? '' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.6
Branch: 3 branches
Condition50%1/2
vname($_[1], $Proc::ShellSubset::AP) and ""
MC/DC0%0/1
vname($_[1], $Proc::ShellSubset::AP) and ""
vname($_[1], $Proc::ShellSubset::AP)
Truth table50%1/2
A
A= vname($_[1], $Proc::ShellSubset::AP)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | : $_[1] =~ /^$NM\z/ ? vname($_[1], $AP) && '' : "unsupported 'getopts' name" }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 32 | ▶ | unset => sub { my $f = ($_[0] // '') =~ /^-[vf]\z/ && shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=12 SCAR=25.6
Condition60%3/5
($_[0] // '') =~ /^-[vf]\z/ && shift()
$_[0] // ""
MC/DC0%0/2
($_[0] // '') =~ /^-[vf]\z/ && shift()
$_[0]
shift()
Truth table33%1/3
A && B
A= $_[0]B= shift()
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 32 | ▶ | @_ or return "'unset' without a name"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 32 | ▶ | for (@_) { if (ref) { return "unsupported 'unset' argument" if grep +(ref ? $$_[0] eq '*' && $$_[1] : $_) =~ /[\[\]]/, @$_; next } # foo[$i]: bash's array | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$_->[0] eq "*" and $_->[1]
MC/DC50%1/2
$_->[0] eq "*" and $_->[1]
$_->[0] eq "*"
$_->[1]
Truth table66%2/3
A and B
A= $_->[0] eq "*"B= $_->[1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 23 | ▶ | /^$NM\z/ or return "unsupported 'unset' argument"; $f eq '-f' or $UNSET{vname($_, $AP)} //= $AP } '' }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$Proc::ShellSubset::UNSET{vname($_, $Proc::ShellSubset::AP)} //= $Proc::ShellSubset::AP
MC/DC0%0/2
$Proc::ShellSubset::UNSET{vname($_, $Proc::ShellSubset::AP)} //= $Proc::ShellSubset::AP
$Proc::ShellSubset::UNSET{vname($_, $Proc::ShellSubset::AP)}
$Proc::ShellSubset::AP
Truth table33%1/3
A //= B
A= $Proc::ShellSubset::UNSET{vname($_, $Proc::ShellSubset::AP)}B= $Proc::ShellSubset::AP
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 96 | ▶ | set => sub { @_ or return "'set' without arguments (it lists)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=18 SCAR=29.1
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 94 | ▶ | while (defined(my $o = shift)) { return '' if ref $o || $o eq '--' || $o !~ /^[-+]/; # operands follow | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%4/6
ref $o or $o eq "--" or not $o =~ /^[-+]/
ref $o or $o eq "--"
MC/DC33%1/3
ref $o or $o eq "--" or not $o =~ /^[-+]/
ref $o
$o eq "--"
not $o =~ /^[-+]/
Truth table50%2/4
A or B or not(C)
A= ref $oB= $o eq "--"C= not $o =~ /^[-+]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 79 | ▶ | if ($o =~ /^[-+]o\z/) { my $n = shift; return '' if ref $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 42 | ▶ | $SETO{$n // ''} || ($n // '') =~ /^(?:vi|emacs)\z/ || ($n // '') eq 'history' && ($O{interactive} // 'nop') ne 'reject' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%15/17
$SETO{$n // ""} or ($n // "") =~ /^(?:vi|emacs)\z/ or ($n // "") eq "history" and ($Proc::ShellSubset::O{"interactive"} // "nop") ne "reject"
$SETO{$n // ""} or ($n // "") =~ /^(?:vi|emacs)\z/
$n // ""
$n // ""
($n // "") eq "history" and ($Proc::ShellSubset::O{"interactive"} // "nop") ne "reject"
$n // ""
$Proc::ShellSubset::O{"interactive"} // "nop"
MC/DC50%2/4
$SETO{$n // ""} or ($n // "") =~ /^(?:vi|emacs)\z/ or ($n // "") eq "history" and ($Proc::ShellSubset::O{"interactive"} // "nop") ne "reject"
$SETO{$n // ""}
$n
$n
$Proc::ShellSubset::O{"interactive"}
Truth table60%3/5
A or B or C and D
A= $SETO{$n // ""}B= $nC= $nD= $Proc::ShellSubset::O{"interactive"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | or return "unsupported 'set -o' form" } # B2: vi, emacs, history do nothing here | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 6 | ▶ | elsif ($o !~ /^[-+][eufCab]+\z/ && $o ne '+m') { return "unsupported 'set' option '$o'" } } '' }, # -b, +m: nothing (P6) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not $o =~ /^[-+][eufCab]+\z/ and $o ne "+m"
MC/DC100%2/2
not $o =~ /^[-+][eufCab]+\z/ and $o ne "+m"
not $o =~ /^[-+][eufCab]+\z/
$o ne "+m"
Truth table100%3/3
not(A) and B
A= not $o =~ /^[-+][eufCab]+\z/B= $o ne "+m"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 63 | ▶ | trap => sub { @_ >= 2 or return "'trap' with fewer than two arguments (it lists)"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.0
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 57 | ▶ | my $x = shift; return "unsupported 'trap' form" if !ref $x && $x =~ /^-.|^[0-9]+\z/; # trap 1 2: a signal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not ref $x and $x =~ /^-.|^[0-9]+\z/
MC/DC100%2/2
not ref $x and $x =~ /^-.|^[0-9]+\z/
not ref $x
$x =~ /^-.|^[0-9]+\z/
Truth table100%3/3
not(A) and B
A= not ref $xB= $x =~ /^-.|^[0-9]+\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 55 | ▶ | return 'trap action outside the subset' if !ref $x && $x =~ /\S/ && $x ne '-' && ref large($x, %O, nolineno => 1) ne 'ARRAY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
not ref $x and $x =~ /\S/ and $x ne "-" and ref large($x, %Proc::ShellSubset::O, "nolineno", 1) ne "ARRAY"
not ref $x and $x =~ /\S/ and $x ne "-"
not ref $x and $x =~ /\S/
MC/DC100%4/4
not ref $x and $x =~ /\S/ and $x ne "-" and ref large($x, %Proc::ShellSubset::O, "nolineno", 1) ne "ARRAY"
not ref $x
$x =~ /\S/
$x ne "-"
ref large($x, %Proc::ShellSubset::O, "nolineno", 1) ne "ARRAY"
Truth table100%5/5
not(A) and B and C and D
A= not ref $xB= $x =~ /\S/C= $x ne "-"D= ref large($x, %Proc::ShellSubset::O, "nolineno", 1) ne "ARRAY"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 51 | ▶ | (grep !ref && !trapsig($_), @_) ? "unsupported signal for 'trap'" : '' }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_ || trapsig($_)
MC/DC50%1/2
ref $_ || trapsig($_)
ref $_
trapsig($_)
Truth table66%2/3
A || B
A= ref $_B= trapsig($_)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 1152 | ▶ | sub large { # the large grammar: Proc::ShellSubset::parse with replacements | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
large: called CC=25 SCAR=32.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 484 | ▶ | my ($s, %o) = @_; no warnings 'redefine'; my $chk = delete $o{check}; $o{fdmulti} //= 1; # rule E: as bash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Condition100%2/2
$o{"fdmulti"} //= 1
MC/DC100%1/1
$o{"fdmulti"} //= 1
$o{"fdmulti"}
Truth table100%2/2
A
A= $o{"fdmulti"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 1152 | ▶ | my $why = $s =~ /\0/ ? ['NUL character', $-[0]] : $chk && $chk->($s) ? [$chk->($s), 0] : undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$chk and &$chk($s)
MC/DC0%0/2
$chk and &$chk($s)
$chk
&$chk($s)
Truth table33%1/3
A and B
A= $chkB= &$chk($s)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1152 | ▶ | my ($t, $map, @hd) = $why ? () : eval { hdcut($s) }; $why //= $@ if ref $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$why //= $@
MC/DC0%0/2
$why //= $@
$why
$@
Truth table33%1/3
A //= B
A= $whyB= $@
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1152 | ▶ | return { error => $$why[0], pos => $$why[1], last => 0, tree => [] } if $why; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1142 | local (@HD, $FUNC, $NOAT, %LOC, %UNSET, $FORALL, $RLIT) = (@hd); ($FUNC, $FORALL, $RLIT) = (0, 1, 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1142 | ▶ | local %FDEF = map +($_ => 1), grep $OWN{$_} || $LBI{$_} || $CHK{$_} || $TREECHK{$_}, # 3A: names with checks of their own; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition88%8/9
$OWN{$_} || $LBI{$_} || $CHK{$_} || $Proc::ShellSubset::TREECHK{$_}
$OWN{$_} or $LBI{$_} or $CHK{$_}
$OWN{$_} or $LBI{$_}
MC/DC75%3/4
$OWN{$_} || $LBI{$_} || $CHK{$_} || $Proc::ShellSubset::TREECHK{$_}
$OWN{$_}
$LBI{$_}
$CHK{$_}
$Proc::ShellSubset::TREECHK{$_}
Truth table80%4/5
A or B or C || D
A= $OWN{$_}B= $LBI{$_}C= $CHK{$_}D= $Proc::ShellSubset::TREECHK{$_}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $s =~ /(?:^|[\s;&|(){}])($NM)[ \t]*\([ \t]*\)/g; # a loose scan: a false hit only defers checks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1142 | local %BI = %LBI; local %SH = %SH; delete @SH{qw(IFS OPTIND OLDPWD PPID)}; # PPID: both shells set it (post4-0.03) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 1142 | ▶ | local ($SUBLOOP, $LN, $SRC, $LOFF, $CUT, @ASH) = (0, $s =~ /LINENO/ && !$o{nolineno}, $s, $o{lineoff} // 0, 0); $LN ? delete $SH{LINENO} : ($SH{LINENO} = 1); # G8: not in eval or trap text | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$s =~ /LINENO/ && !$o{'nolineno'}
$o{"lineoff"} // 0
MC/DC100%2/2
$s =~ /LINENO/ && !$o{'nolineno'}
$s =~ /LINENO/
!$o{'nolineno'}
MC/DC100%1/1
$o{"lineoff"} // 0
$o{"lineoff"}
Truth table100%3/3
A && not(B)
A= $s =~ /LINENO/B= !$o{'nolineno'}
Truth table100%2/2
A
A= $o{"lineoff"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1142 | ▶ | delete $SH{UID} if $s =~ /(?:^|[\s;&|(){}])UID=/; # G15 (rule E, as dash): an ordinary variable where the text sets it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1142 | local $TILDEPW = 1; # G16 (rule E, as bash): ~ without HOME is the home in the password file | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1142 | ▶ | local *shell = sub { local $SUBLOOP = $SUBLOOP + ($LOOP // 0); $o_shell->(@_) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$Proc::ShellSubset::LOOP // 0
MC/DC100%1/1
$Proc::ShellSubset::LOOP // 0
$Proc::ShellSubset::LOOP
Truth table100%2/2
A
A= $Proc::ShellSubset::LOOP
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1142 | ▶ | delete @BI{@INTER} unless ($o{interactive} // 'nop') eq 'reject'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$o{"interactive"} // "nop"
MC/DC100%1/1
$o{"interactive"} // "nop"
$o{"interactive"}
Truth table100%2/2
A
A= $o{"interactive"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1142 | ▶ | local %ALIAS = map +($_ => [[0, $o{aliases}{$_}]]), keys %{$o{aliases} // {}}; local (@AEXP, $ANEXT); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$o{"aliases"} // {}
MC/DC100%1/1
$o{"aliases"} // {}
$o{"aliases"}
Truth table100%2/2
A
A= $o{"aliases"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1142 | ▶ | local *P = sub { my $p = shift; $M ? $$M[$p] // $$M[-1] : $map ? $$map[$p] // $$map[-1] : $p }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=17.5
Branch: 2 branches
Condition33%2/6
$Proc::ShellSubset::M->[$p] // $Proc::ShellSubset::M->[-1]
$map->[$p] // $map->[-1]
MC/DC0%0/2
$Proc::ShellSubset::M->[$p] // $Proc::ShellSubset::M->[-1]
$Proc::ShellSubset::M->[$p]
$Proc::ShellSubset::M->[-1]
MC/DC0%0/2
$map->[$p] // $map->[-1]
$map->[$p]
$map->[-1]
Truth table33%1/3
A // B
A= $Proc::ShellSubset::M->[$p]B= $Proc::ShellSubset::M->[-1]
Truth table33%1/3
A // B
A= $map->[$p]B= $map->[-1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1142 | local *simple = \&l_simple; local *command = \&l_command; local *dollar = \&l_dollar; local *redir = \&l_redir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1142 | ▶ | local *arith = \&l_arith; local *vname = \&l_vname; local *word = \&l_word; local *xc = sub {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 1142 | ▶ | local *bq = sub { local $NOAT; &$o_bq }; # a $( ) or `...` starts afresh | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1142 | local $PIECE = $LPIECE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1142 | my $r = parse($t, %o); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1142 | ▶ | if (ref $r eq 'ARRAY') { # bodies read for a << that turned out to be text; unset of a name some function made local | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 695 | ▶ | @HD && !$CUT and return { error => 'here-document body not used', pos => $HD[0][2], last => 0, tree => $r }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@Proc::ShellSubset::HD and not $Proc::ShellSubset::CUT
MC/DC50%1/2
@Proc::ShellSubset::HD and not $Proc::ShellSubset::CUT
@Proc::ShellSubset::HD
not $Proc::ShellSubset::CUT
Truth table66%2/3
A and not(B)
A= @Proc::ShellSubset::HDB= not $Proc::ShellSubset::CUT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 693 | my ($n) = grep $LOC{$_}, sort { $UNSET{$a} <=> $UNSET{$b} } keys %UNSET; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 693 | ▶ | return { error => "unset of '$n', which a function makes local", pos => $UNSET{$n}, last => 0, tree => $r } if $n } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 1138 | ▶ | $r->{last} = $$map[$r->{last}] if ref $r eq 'HASH' && $map; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $r eq "HASH" and $map
MC/DC100%2/2
ref $r eq "HASH" and $map
ref $r eq "HASH"
$map
Truth table100%3/3
A and B
A= ref $r eq "HASH"B= $map
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1138 | $r } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 484 | my $HDQ = qr/\G(?: (?<bn>\\\n) | \\. | (?<cq>") | \$\(\((?<ar>(?:[^()]++|\((?&ar)\))*)\)\) | (?<op>\$\() | (?<bq>`) | [^"\\\$`]+ | . )/sx; # inside "..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 484 | my $HCODE = qr/\G(?: '[^']*' | (?<oq>") | (?<bn>\\\n) | \\. | \$\(\((?<ar>(?:[^()]++|\((?&ar)\))*)\)\) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | | (?<![^ \t\n;&|()<>])\#[^\n]* | <<(?!<)(?<t>-?)[ \t]*(?<d>$DELIM) | (?<nl>\n) | (?<op>\$?\() | (?<cl>\)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | | (?<bq>`) | [^'"\\\$#<\n()`]+ | . )/sx; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 1152 | ▶ | sub hdcut { # cut out the here-document bodies, and each \-newline outside '...' and comments (D2): | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hdcut: called CC=41 SCAR=37.2
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1152 | my $s = shift; my (@pend, @hd, $t, @m, $inbq, @st, $cut); my ($at, $depth) = (0, 0); # (the rest, its | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 28 | ▶ | my $skip = sub { my ($from, $to) = @_; $t .= substr $s, $at, $from - $at; push @m, $at .. $from - 1; # position | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 1152 | ($at, $cut) = ($to, 1) }; # map or undef, bodies) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 1152 | ▶ | while (@st && $st[-1] eq 'q' ? $s =~ /$HDQ/gc : $s =~ /$HCODE/gc) { # @st: open "...", as 'q', and the depths of $( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
@st and $st[-1] eq "q"
MC/DC100%2/2
@st and $st[-1] eq "q"
@st
$st[-1] eq "q"
Truth table100%3/3
A and B
A= @stB= $st[-1] eq "q"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 5222 | ▶ | if (defined $+{bn}) { $skip->($-[0], pos $s) } # opened in them | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 59 | elsif (defined $+{ar}) { my ($i, $e) = ($-[0], pos $s); # \-newline inside $(( )) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 59 | ▶ | $skip->($i, $i + 2), $i += 2 while ($i = index $s, "\\\n", $i) >= 0 && $i < $e } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
($i = index($s, "\\\n", $i)) >= 0 and $i < $e
MC/DC100%2/2
($i = index($s, "\\\n", $i)) >= 0 and $i < $e
($i = index($s, "\\\n", $i)) >= 0
$i < $e
Truth table100%3/3
A and B
A= ($i = index($s, "\\\n", $i)) >= 0B= $i < $e
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 314 | elsif (defined $+{oq}) { push @st, 'q' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 308 | elsif (defined $+{cq}) { pop @st } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | elsif (defined $+{d}) { # [delimiter as written, <<-, position, depth in ( and $(] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 63 | ▶ | die [$inbq ? 'here-document inside backquotes' : 'here-document delimiter with an expansion', $-[0]] if $inbq || $+{d} =~ /\$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$inbq or $+{"d"} =~ /\$/
MC/DC100%2/2
$inbq or $+{"d"} =~ /\$/
$inbq
$+{"d"} =~ /\$/
Truth table100%3/3
A or B
A= $inbqB= $+{"d"} =~ /\$/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 59 | push @pend, [$+{d}, $+{t}, $-[0], $depth] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 224 | ▶ | elsif (defined $+{op}) { push @st, $depth if @st && $st[-1] eq 'q'; $depth++ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@st and $st[-1] eq "q"
MC/DC50%1/2
@st and $st[-1] eq "q"
@st
$st[-1] eq "q"
Truth table66%2/3
A and B
A= @stB= $st[-1] eq "q"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 248 | ▶ | elsif (defined $+{cl}) { $depth--; die ["here-document in a '(' or '\$(' that ends on its line", $pend[-1][2]] if @pend && $depth < $pend[-1][3]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@pend and $depth < $pend[-1][3]
MC/DC50%1/2
@pend and $depth < $pend[-1][3]
@pend
$depth < $pend[-1][3]
Truth table66%2/3
A and B
A= @pendB= $depth < $pend[-1][3]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 244 | ▶ | pop @st if @st && $st[-1] ne 'q' && $st[-1] == $depth } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
@st and $st[-1] ne "q" and $st[-1] == $depth
@st and $st[-1] ne "q"
MC/DC33%1/3
@st and $st[-1] ne "q" and $st[-1] == $depth
@st
$st[-1] ne "q"
$st[-1] == $depth
Truth table50%2/4
A and B and C
A= @stB= $st[-1] ne "q"C= $st[-1] == $depth
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 48 | elsif (defined $+{bq}) { $inbq = !$inbq } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | ▶ | elsif (defined $+{nl} && @pend) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $+{"nl"} and @pend
MC/DC100%2/2
defined $+{"nl"} and @pend
defined $+{"nl"}
@pend
Truth table100%3/3
A and B
A= defined $+{"nl"}B= @pend
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 46 | my $b0 = pos $s; $t .= substr $s, $at, $b0 - $at; push @m, $at .. $b0 - 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 46 | for (splice @pend) { # body: [delimiter as written, Word (string) or [text, map], position] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 50 | my ($raw, $tab, $p) = @$_; my ($body, $cont, @bm) = (''); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 50 | my $lit = $raw =~ /['"\\]/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 50 | ▶ | (my $d = $raw) =~ s{'([^']*)'|"((?:[^"\\]|\\.)*)"|\\(.)}{$1 // (defined $2 ? $2 =~ s/\\([\$`"\\])/$1/gr : $3)}gse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$1 // (defined $2 ? $2 =~ s/\\([\$`"\\])/$1/gr : $3)
MC/DC0%0/2
$1 // (defined $2 ? $2 =~ s/\\([\$`"\\])/$1/gr : $3)
$1
(defined $2 ? $2 =~ s/\\([\$`"\\])/$1/gr : $3)
Truth table66%2/3
A // B
A= $1B= (defined $2 ? $2 =~ s/\\([\$`"\\])/$1/gr : $3)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 50 | while (1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 107 | ▶ | $s =~ /\G([^\n]*)(\n?)/gc && ($1 ne '' || $2 ne '') or die ['unterminated here-document', $p]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$s =~ /\G([^\n]*)(\n?)/cg and $1 ne "" || $2 ne ""
$1 ne "" or $2 ne ""
MC/DC33%1/3
$s =~ /\G([^\n]*)(\n?)/cg and $1 ne "" || $2 ne ""
$s =~ /\G([^\n]*)(\n?)/cg
$1 ne ""
$2 ne ""
Truth table50%2/4
A and B or C
A= $s =~ /\G([^\n]*)(\n?)/cgB= $1 ne ""C= $2 ne ""
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 105 | my ($line, $nl, $c0) = ($1, $2, $-[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 105 | ▶ | if ($tab && !$cont) { $line =~ s/^(\t*)//; $c0 += length $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$tab and not $cont
MC/DC50%1/2
$tab and not $cont
$tab
not $cont
Truth table66%2/3
A and not(B)
A= $tabB= not $cont
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 105 | ▶ | last if !$cont && $line eq $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $cont and $line eq $d
MC/DC100%2/2
not $cont and $line eq $d
not $cont
$line eq $d
Truth table100%3/3
not(A) and B
A= not $contB= $line eq $d
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 57 | ▶ | $cont = !$lit && $nl && $line =~ /(?<!\\)(?:\\\\)*\\\z/; # an unquoted body joins a line ending in \ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
!$lit && $nl && $line =~ /(?<!\\)(?:\\\\)*\\\z/
not $lit and $nl
MC/DC100%3/3
!$lit && $nl && $line =~ /(?<!\\)(?:\\\\)*\\\z/
not $lit
$nl
$line =~ /(?<!\\)(?:\\\\)*\\\z/
Truth table100%4/4
not(A) and B && C
A= not $litB= $nlC= $line =~ /(?<!\\)(?:\\\\)*\\\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 57 | $body .= $line . $nl; push @bm, $c0 .. $c0 + length($line . $nl) - 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 48 | ▶ | push @hd, [$raw, $lit ? $body : [$body, [@bm, pos $s]], $p] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 44 | $at = pos $s } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1142 | ▶ | @hd || $cut or return $s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@hd or $cut
MC/DC100%2/2
@hd or $cut
@hd
$cut
Truth table100%3/3
A or B
A= @hdB= $cut
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 64 | $t .= substr $s, $at; push @m, $at .. length($s); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 64 | ($t, \@m, @hd) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 66 | ▶ | sub settable { # post-0.04: a name known only at run time (read $v, export "$v"): may the large subset set it? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
settable: called CC=4 SCAR=14.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 66 | ▶ | my $n = shift; return 0 unless $n =~ /^$NM\z/ && $n !~ /^(?:CDPATH|PPID|LINENO)\z/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$n =~ /^$Proc::ShellSubset::NM\z/ and not $n =~ /^(?:CDPATH|PPID|LINENO)\z/
MC/DC0%0/2
$n =~ /^$Proc::ShellSubset::NM\z/ and not $n =~ /^(?:CDPATH|PPID|LINENO)\z/
$n =~ /^$Proc::ShellSubset::NM\z/
not $n =~ /^(?:CDPATH|PPID|LINENO)\z/
Truth table33%1/3
A and not(B)
A= $n =~ /^$Proc::ShellSubset::NM\z/B= not $n =~ /^(?:CDPATH|PPID|LINENO)\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 66 | ▶ | return 1 if $SETOK{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 66 | local %SH = %SH; delete @SH{qw(IFS OPTIND OLDPWD PPID UID)}; # as large() does (UID: G15, where a string sets it) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 66 | local %O; eval { name($n, 0); 1 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 314 | ▶ | sub l_vname { my ($n, $p) = @_; E("assignment to '$n'", $p) if $n =~ /^(?:CDPATH|PPID|LINENO)\z/; $SETOK{$n} ? $n : name($n, $p) } # HOME: post-0.04 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_vname: called CC=3 SCAR=11.0
Pod
undocumented
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 4681 | ▶ | sub l_word { local $NOAT = $NOAT || $_[0] =~ /[er]/; &$o_word } # a setting's value, a redirection target | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_word: called CC=2 SCAR=7.1
Pod
undocumented
Condition66%2/3
$Proc::ShellSubset::NOAT || $_[0] =~ /[er]/
MC/DC50%1/2
$Proc::ShellSubset::NOAT || $_[0] =~ /[er]/
$Proc::ShellSubset::NOAT
$_[0] =~ /[er]/
Truth table66%2/3
A || B
A= $Proc::ShellSubset::NOATB= $_[0] =~ /[er]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 11 | ▶ | sub at_in { my $w = shift; ref $w and grep ref && $$_[0] =~ /^"?\$\{?\z/ && $$_[1] eq '@', @$w } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at_in: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 1 branch
Condition66%4/6
ref $_ && $_->[0] =~ /^"?\$\{?\z/ && $_->[1] eq '@'
ref $_ and $_->[0] =~ /^"?\$\{?\z/
MC/DC33%1/3
ref $_ && $_->[0] =~ /^"?\$\{?\z/ && $_->[1] eq '@'
ref $_
$_->[0] =~ /^"?\$\{?\z/
$_->[1] eq '@'
Truth table50%2/4
A and B && C
A= ref $_B= $_->[0] =~ /^"?\$\{?\z/C= $_->[1] eq '@'
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 5 | ▶ | sub bqdq { # after '`' inside "${...}" or a here-document: \" there is " in bash, \" in dash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bqdq: called CC=3 SCAR=11.1
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 5 | ▶ | my $p = shift; /\G((?:[^`\\]|\\.)*)/s and $1 =~ /\\"/ and E('\\" in backquotes here (dash and bash differ)', $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/\G((?:[^`\\]|\\.)*)/s and $1 =~ /\\"/
MC/DC50%1/2
/\G((?:[^`\\]|\\.)*)/s and $1 =~ /\\"/
/\G((?:[^`\\]|\\.)*)/s
$1 =~ /\\"/
Truth table66%2/3
A and B
A= /\G((?:[^`\\]|\\.)*)/sB= $1 =~ /\\"/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 2345 | ▶ | sub l_command { # NAME() COMPOUND-COMMAND is a function definition (F1); anything else as in Proc::ShellSubset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_command: called CC=10 SCAR=23.0
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 2345 | my $pl = shift; my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 2345 | ▶ | unless (/\G($NM)$B\($B\)$BN/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 2251 | my $i = @$pl; my $c = $o_command->($pl); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1840 | ▶ | $pl->[$i]{line} = lineof($p) if $LN && ref $pl->[$i] eq 'HASH'; # G8: the line where the command starts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$Proc::ShellSubset::LN and ref $pl->[$i] eq "HASH"
MC/DC50%1/2
$Proc::ShellSubset::LN and ref $pl->[$i] eq "HASH"
$Proc::ShellSubset::LN
ref $pl->[$i] eq "HASH"
Truth table66%2/3
A and B
A= $Proc::ShellSubset::LNB= ref $pl->[$i] eq "HASH"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1840 | ▶ | E("'\$\@' as the word of 'case'", $p) if ref $c && exists $c->{case} && at_in($c->{case}); # joined: IFS or blank | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
ref $c and exists $c->{"case"} and at_in($c->{"case"})
ref $c and exists $c->{"case"}
MC/DC100%3/3
ref $c and exists $c->{"case"} and at_in($c->{"case"})
ref $c
exists $c->{"case"}
at_in($c->{"case"})
Truth table100%4/4
A and B and C
A= ref $cB= exists $c->{"case"}C= at_in($c->{"case"})
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1838 | return $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 94 | ▶ | my $n = $1; E("function named '$n'", $p) if $KW{$n} || $NOFN{$n}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Proc::ShellSubset::KW{$n} or $NOFN{$n}
MC/DC100%2/2
$Proc::ShellSubset::KW{$n} or $NOFN{$n}
$Proc::ShellSubset::KW{$n}
$NOFN{$n}
Truth table100%3/3
A or B
A= $Proc::ShellSubset::KW{$n}B= $NOFN{$n}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 84 | ▶ | /\G(?=[{(]|(?:if|while|until|for|case)$END)/ or E('function body not a compound command', pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 80 | my @b; push @$pl, my $c = { func => $n, body => \@b }; local $FUNC = $FUNC + 1; local ($LOOP, $SUBLOOP) = (0, 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 80 | { local $OPEN[@OPEN] = \@b; $o_command->(\@b) } $c->{body} = $b[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 69 | $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 2137 | ▶ | sub l_simple { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_simple: called CC=112 SCAR=47.4
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 2137 | my $pl = shift; my (@env, @np, @av, @ap, @r, $kw, @dv); my $p0 = pos; # @dv: NAME, Word or undef (declarations) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 2137 | ▶ | if (%ALIAS) { /\G[ \t]*/gc; alias_expand(); $p0 = pos } # B1: an alias as the command name | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 2135 | push @$pl, my $c = { argv => \@av }; local $OPEN[@OPEN] = \@av; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 2135 | ▶ | while (/\G$B/gc, !/\G(?=[;&|()\n]|\z)/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 4752 | my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 4752 | ▶ | if (defined $ANEXT && $p >= $ANEXT) { undef $ANEXT; next if alias_expand() } # the word after an alias ending in a blank | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
defined $Proc::ShellSubset::ANEXT and $p >= $Proc::ShellSubset::ANEXT
MC/DC100%2/2
defined $Proc::ShellSubset::ANEXT and $p >= $Proc::ShellSubset::ANEXT
defined $Proc::ShellSubset::ANEXT
$p >= $Proc::ShellSubset::ANEXT
Truth table100%3/3
A and B
A= defined $Proc::ShellSubset::ANEXTB= $p >= $Proc::ShellSubset::ANEXT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 4749 | ▶ | E("unexpected '$1'", $p) if !@av && /\G([{}])$END/; # '{' or '}' as a command name: a reserved word, not text (P1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @av and /\G([{}])$Proc::ShellSubset::END/
MC/DC100%2/2
not @av and /\G([{}])$Proc::ShellSubset::END/
not @av
/\G([{}])$Proc::ShellSubset::END/
Truth table100%3/3
not(A) and B
A= not @avB= /\G([{}])$Proc::ShellSubset::END/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 4738 | ▶ | E("'{NAME}' before a redirection (bash: a named descriptor)", $p) if /\G\{$NM\}[<>]/; # exec {fd}>f (P1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 4731 | ▶ | if (my $r = redir()) { push @r, $r } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 178 | ▶ | elsif (!@av and /\G($NM)(\+?)=/gc) { E("'$1+='", $p) if $2; my $n = $1; push @np, $n, $p; push @env, $n, word(q{e}) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @av and /\G($Proc::ShellSubset::NM)(\+?)=/cg
MC/DC100%2/2
not @av and /\G($Proc::ShellSubset::NM)(\+?)=/cg
not @av
/\G($Proc::ShellSubset::NM)(\+?)=/cg
Truth table100%3/3
not(A) and B
A= not @avB= /\G($Proc::ShellSubset::NM)(\+?)=/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | ▶ | elsif (@av && $kw =~ /^(?:export|readonly|local)\z/) { # NAME[=value]: no splitting (F5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@av and $kw =~ /^(?:export|readonly|local)\z/
MC/DC100%2/2
@av and $kw =~ /^(?:export|readonly|local)\z/
@av
$kw =~ /^(?:export|readonly|local)\z/
Truth table100%3/3
A and B
A= @avB= $kw =~ /^(?:export|readonly|local)\z/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 49 | ▶ | if ($kw eq 'export' && /\G(?|"\$(?|\{($NM)\}|($NM))"()$END|\$(?|\{($NM)\}|($NM))(?:(=)|$END))/gc) { # export $v[=value], "$v": the name at run time (P4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$kw eq "export" and /\G(?|"\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))"()$Proc::ShellSubset::END|\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))(?:(=)|$Proc::ShellSubset::END))/cg
MC/DC100%2/2
$kw eq "export" and /\G(?|"\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))"()$Proc::ShellSubset::END|\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))(?:(=)|$Proc::ShellSubset::END))/cg
$kw eq "export"
/\G(?|"\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))"()$Proc::ShellSubset::END|\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))(?:(=)|$Proc::ShellSubset::END))/cg
Truth table100%3/3
A and B
A= $kw eq "export"B= /\G(?|"\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))"()$Proc::ShellSubset::END|\$(?|\{($Proc::ShellSubset::NM)\}|($Proc::ShellSubset::NM))(?:(=)|$Proc::ShellSubset::END))/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 14 | ▶ | my ($v, $eq) = ($1, $2); my $w = $eq ? word(q{a}) : undef; # the shells split an unquoted value, and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 14 | ▶ | E("unsupported 'export' value (not an assignment: split, no ~)", $p) # do not expand ~ in it | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
ref $w and grep((ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq "~")), @$w)
ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq '~')
not $_->[0] =~ /^"/ or $_->[0] eq "~"
MC/DC100%2/2
ref $w and grep((ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq "~")), @$w)
ref $w
grep((ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq "~")), @$w)
MC/DC66%2/3
ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq '~')
ref $_
not $_->[0] =~ /^"/
$_->[0] eq "~"
Truth table100%3/3
A and B
A= ref $wB= grep((ref $_ && (!($_->[0] =~ /^"/) || $_->[0] eq "~")), @$w)
Truth table75%3/4
A && not(B) or C
A= ref $_B= not $_->[0] =~ /^"/C= $_->[0] eq "~"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | if ref $w && grep ref && ($$_[0] !~ /^"/ || $$_[0] eq '~'), @$w; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 10 | push @dv, [['"$', name($v, $p)]], $w; next } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 35 | ▶ | /\G($NM)(?:(=)|$END)/gc or E("unsupported '$kw' argument", $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 31 | my ($n, $eq) = ($1, $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 31 | ▶ | E("'$kw $n' without a value (dash sets it, bash does not)", $p) if $SETOK{$n} && !$eq; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$SETOK{$n} and not $eq
MC/DC50%1/2
$SETOK{$n} and not $eq
$SETOK{$n}
not $eq
Truth table66%2/3
A and not(B)
A= $SETOK{$n}B= not $eq
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 29 | ▶ | push @dv, vname($n, $p), $eq ? word(q{e}) : undef } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4293 | ▶ | else { push @av, word('a'); push @ap, $p; $kw //= substr $_, $p, pos() - $p } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$kw //= substr($_, $p, pos($_) - $p)
MC/DC0%0/2
$kw //= substr($_, $p, pos($_) - $p)
$kw
substr($_, $p, pos($_) - $p)
Truth table66%2/3
A //= B
A= $kwB= substr($_, $p, pos($_) - $p)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 1921 | vname(@$_) for pairs @np; # settings may outlast special builtins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 1911 | ▶ | if (!@av) { # settings alone, redirections alone (D2), or both: dash redirects before it expands the values, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 164 | ▶ | @env || @r or E('missing command', $p0); # bash after; so both only with no $ or ` | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@env or @r
MC/DC100%2/2
@env or @r
@env
@r
Truth table100%3/3
A or B
A= @envB= @r
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 161 | ▶ | E("'&>' (dash: '&', then a redirection; bash: both outputs)", $p0 - 1) if !@env && $p0 && substr($_, $p0 - 1, 2) eq '&>' && substr($_, $p0 - 2, 1) ne '&'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
not @env and $p0 and substr($_, $p0 - 1, 2) eq "&>" and substr($_, $p0 - 2, 1) ne "&"
not @env and $p0 and substr($_, $p0 - 1, 2) eq "&>"
not @env and $p0
MC/DC100%4/4
not @env and $p0 and substr($_, $p0 - 1, 2) eq "&>" and substr($_, $p0 - 2, 1) ne "&"
not @env
$p0
substr($_, $p0 - 1, 2) eq "&>"
substr($_, $p0 - 2, 1) ne "&"
Truth table100%5/5
not(A) and B and C and D
A= not @envB= $p0C= substr($_, $p0 - 1, 2) eq "&>"D= substr($_, $p0 - 2, 1) ne "&"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 156 | ▶ | E("an input redirection without a command (bash: \$(<file) reads the file)", $p0) if !@env && grep $$_[1] =~ /^</, @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not @env and grep(($_->[1] =~ /^</), @r)
MC/DC100%2/2
not @env and grep(($_->[1] =~ /^</), @r)
not @env
grep(($_->[1] =~ /^</), @r)
Truth table100%3/3
not(A) and B
A= not @envB= grep(($_->[1] =~ /^</), @r)
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | # settings with redirections and a $, ` or here-document: redirected first, as dash and POSIX (rule E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 145 | ▶ | return %$c = (@env ? (set => \@env) : (argv => []), @r ? (redir => \@r) : ()) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1747 | ▶ | E("keyword '$kw'", $ap[0]) if $KW{$kw}; # also when it is a pattern, as [[ is | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 1737 | ▶ | E("'NAME[' as a command (bash reads an array)", $ap[0]) if $kw =~ /^$NM\[/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1729 | ▶ | if (!ref $av[0] && $av[0] eq 'exec') { # anywhere: it ends the shell (F3) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
not ref $av[0] and $av[0] eq "exec"
MC/DC100%2/2
not ref $av[0] and $av[0] eq "exec"
not ref $av[0]
$av[0] eq "exec"
Truth table100%3/3
not(A) and B
A= not ref $av[0]B= $av[0] eq "exec"
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 32 | shift @av; shift @ap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 32 | ▶ | if (!@av) { @r && !@env or E("'exec' without a command", $p0); return %$c = (exec => 1, redir => \@r) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@r and not @env
MC/DC50%1/2
@r and not @env
@r
not @env
Truth table66%2/3
A and not(B)
A= @rB= not @env
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 24 | ▶ | E("unsupported 'exec' form", $ap[0]) if !ref $av[0] && ($av[0] =~ /^-/ || $OWN{$av[0]} || $LBI{$av[0]}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
not ref $av[0] and $av[0] =~ /^-/ || $OWN{$av[0]} || $LBI{$av[0]}
$av[0] =~ /^-/ or $OWN{$av[0]} or $LBI{$av[0]}
$av[0] =~ /^-/ or $OWN{$av[0]}
MC/DC50%2/4
not ref $av[0] and $av[0] =~ /^-/ || $OWN{$av[0]} || $LBI{$av[0]}
not ref $av[0]
$av[0] =~ /^-/
$OWN{$av[0]}
$LBI{$av[0]}
Truth table60%3/5
not(A) and B or C or D
A= not ref $av[0]B= $av[0] =~ /^-/C= $OWN{$av[0]}D= $LBI{$av[0]}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 17 | $c->{exec} = 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 16 | ▶ | elsif (!ref($av[0]) && $FDEF{$av[0]}) { $c->{fn} = 1 } # 3A: maybe a function; else the builtin's checks at run time | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not ref $av[0] and $Proc::ShellSubset::FDEF{$av[0]}
MC/DC100%2/2
not ref $av[0] and $Proc::ShellSubset::FDEF{$av[0]}
not ref $av[0]
$Proc::ShellSubset::FDEF{$av[0]}
Truth table100%3/3
not(A) and B
A= not ref $av[0]B= $Proc::ShellSubset::FDEF{$av[0]}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | elsif (!ref(my $n = $av[0])) { # a literal name; else decided at run time | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1665 | local $AP = $ap[0]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 1665 | ▶ | if ($n =~ /^(?:break|continue)\z/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 21 | ▶ | E("'$n' outside a loop", $AP) unless $LOOP + $SUBLOOP; # in a subshell inside a loop: it ends the subshell (as dash) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 13 | ▶ | E("unsupported '$n' form", $AP) if @env || @r || @av > 2 || @av == 2 && ($av[1] !~ /^[1-9][0-9]*\z/ || $av[1] > $LOOP + $SUBLOOP) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition60%9/15
@env or @r or @av > 2 or @av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
@env or @r or @av > 2
@env or @r
@av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
not $av[1] =~ /^[1-9][0-9]*\z/ or $av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
MC/DC33%2/6
@env or @r or @av > 2 or @av == 2 and !($av[1] =~ /^[1-9][0-9]*\z/) || $av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
@env
@r
@av > 2
@av == 2
not $av[1] =~ /^[1-9][0-9]*\z/
$av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
Truth table42%3/7
A or B or C or D and not(E) or F
A= @envB= @rC= @av > 2D= @av == 2E= not $av[1] =~ /^[1-9][0-9]*\z/F= $av[1] > $Proc::ShellSubset::LOOP + $Proc::ShellSubset::SUBLOOP
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | elsif ($n eq 'read') { # read [-r] [-p PROMPT] NAME... (-p: P6) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 39 | ▶ | my $i = 1; while (!ref $av[$i] && ($av[$i] // '') =~ /^-(r*)(p?)\z/ && "$1$2" ne '') { $i += $2 ? 2 : 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition87%7/8
not ref $av[$i] and ($av[$i] // "") =~ /^-(r*)(p?)\z/ and "$1$2" ne ""
not ref $av[$i] and ($av[$i] // "") =~ /^-(r*)(p?)\z/
$av[$i] // ""
MC/DC66%2/3
not ref $av[$i] and ($av[$i] // "") =~ /^-(r*)(p?)\z/ and "$1$2" ne ""
not ref $av[$i]
$av[$i]
"$1$2" ne ""
Truth table75%3/4
not(A) and B and C
A= not ref $av[$i]B= $av[$i]C= "$1$2" ne ""
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 39 | ▶ | $i <= $#av or E("'read' without a variable name", $AP); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 36 | for my $j ($i .. $#av) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 46 | ▶ | if (ref $av[$j]) { E("unsupported 'read' argument", $ap[$j]) if grep +(ref ? $$_[0] eq '*' && $$_[1] : $_) =~ /[\[\]]/, @{$av[$j]}; next } # a name from an | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$_->[0] eq "*" and $_->[1]
MC/DC50%1/2
$_->[0] eq "*" and $_->[1]
$_->[0] eq "*"
$_->[1]
Truth table66%2/3
A and B
A= $_->[0] eq "*"B= $_->[1]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 36 | ▶ | $av[$j] =~ /^$NM\z/ or E("unsupported 'read' argument", $ap[$j]); vname($av[$j], $ap[$j]) } } # expansion: checked at run time (post-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 9 | elsif ($BI{$n}) { E("builtin '$n'", $AP) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | elsif ($n =~ /^(?:export|readonly|local)\z/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 31 | ▶ | @dv && !@env && !@r or E(@dv ? "settings or redirections on '$n'" : "'$n' without arguments, or quoted", $AP); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
@dv and not @env and not @r
@dv and not @env
MC/DC66%2/3
@dv and not @env and not @r
@dv
not @env
not @r
Truth table75%3/4
A and not(B) and not(C)
A= @dvB= not @envC= not @r
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 28 | ▶ | if ($n eq 'local') { $FUNC or E("'local' outside a function", $AP); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 7 | ▶ | E("'local NAME' without a value", $AP) if grep !defined, pairvalues @dv; $LOC{$_->[0]} = 1 for pairs @dv } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 21 | return %$c = ($n => \@dv) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | elsif ($n eq 'cd') { # cd [-L|-P]... [--] [DIR] (P6: the last of -L, -P counts) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 55 | ▶ | my ($i, $phys) = (1, 0); while (!ref $av[$i] && ($av[$i] // '') =~ /^-[LP]+\z/) { $phys = substr($av[$i++], -1) eq 'P' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
not ref $av[$i] and ($av[$i] // "") =~ /^-[LP]+\z/
$av[$i] // ""
MC/DC100%2/2
not ref $av[$i] and ($av[$i] // "") =~ /^-[LP]+\z/
not ref $av[$i]
$av[$i]
Truth table100%3/3
not(A) and B
A= not ref $av[$i]B= $av[$i]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 55 | ▶ | $i++ if $i > 1 && !ref $av[$i] && ($av[$i] // '') eq '--'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition87%7/8
$i > 1 and not ref $av[$i] and ($av[$i] // "") eq "--"
$i > 1 and not ref $av[$i]
$av[$i] // ""
MC/DC66%2/3
$i > 1 and not ref $av[$i] and ($av[$i] // "") eq "--"
$i > 1
not ref $av[$i]
$av[$i]
Truth table75%3/4
A and not(B) and C
A= $i > 1B= not ref $av[$i]C= $av[$i]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 55 | ▶ | !@env && !defined $ENV{CDPATH} && (ref $av[$i] || ($av[$i] // '') !~ /^-./ && ($i == 1 || ($av[$i] // '') ne '-')) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition84%16/19
not @env || defined $ENV{"CDPATH"} and ref $av[$i] || !(($av[$i] // "") =~ /^-./) && ($i == 1 || ($av[$i] // "") ne "-")
@env || defined $ENV{'CDPATH'}
ref $av[$i] or not +($av[$i] // "") =~ /^-./ and $i == 1 || ($av[$i] // "") ne "-"
not +($av[$i] // "") =~ /^-./ and $i == 1 || ($av[$i] // "") ne "-"
$av[$i] // ""
$i == 1 or ($av[$i] // "") ne "-"
$av[$i] // ""
MC/DC50%3/6
not @env || defined $ENV{"CDPATH"} and ref $av[$i] || !(($av[$i] // "") =~ /^-./) && ($i == 1 || ($av[$i] // "") ne "-")
@env
defined $ENV{'CDPATH'}
ref $av[$i]
$av[$i]
$i == 1
$av[$i]
Truth table57%4/7
not(A || B) and C or not(D) and E or F
A= @envB= defined $ENV{'CDPATH'}C= ref $av[$i]D= $av[$i]E= $i == 1F= $av[$i]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | or E('unsupported cd form', $AP); # 'cd -' is allowed (F12), but not after options | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 51 | ▶ | return %$c = (cd => $av[$i], $phys ? (cd_p => 1) : (), @av > $i + 1 ? (cd_extra => 1) : (), @r ? (redir => \@r) : ()) } # more operands: an error, as bash (rule E) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1556 | ▶ | if (my $chk = $CHK{$n}) { E($_, $AP) for grep $_, $chk->(@av[1 .. $#av]) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1478 | ▶ | if ($n eq 'unalias' || $n eq 'alias' && grep ref || /=/, @av[1 .. $#av]) { # listing: anywhere | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
$n eq "unalias" or $n eq "alias" and grep((ref $_ || /=/), @av[1 .. $#av])
$n eq "alias" and grep((ref $_ || /=/), @av[1 .. $#av])
ref $_ || /=/
MC/DC100%3/3
$n eq "unalias" or $n eq "alias" and grep((ref $_ || /=/), @av[1 .. $#av])
$n eq "unalias"
$n eq "alias"
grep((ref $_ || /=/), @av[1 .. $#av])
MC/DC100%2/2
ref $_ || /=/
ref $_
/=/
Truth table100%4/4
A or B and C
A= $n eq "unalias"B= $n eq "alias"C= grep((ref $_ || /=/), @av[1 .. $#av])
Truth table100%3/3
A || B
A= ref $_B= /=/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 52 | ▶ | (grep ref, @av[1 .. $#av]) ? ($CUT = 1) : alias_def($n, $p0, \@env, \@r, @av[1 .. $#av]) } } # P1: known only when it runs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1527 | ▶ | $c->{env} = \@env if @env; $c->{redir} = \@r if @r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1527 | $c } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 54 | ▶ | sub alias_at { my ($n, $p) = @_; my $v; for (@{$ALIAS{$n} // []}) { last if $$_[0] > $p; $v = $$_[1] } $v } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias_at: called CC=4 SCAR=13.9
Pod
undocumented
Branch: 1 branch
Condition100%2/2
$Proc::ShellSubset::ALIAS{$n} // []
MC/DC100%1/1
$Proc::ShellSubset::ALIAS{$n} // []
$Proc::ShellSubset::ALIAS{$n}
Truth table100%2/2
A
A= $Proc::ShellSubset::ALIAS{$n}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 54 | ▶ | sub alias_expand { # B1: if the word at pos is an alias in force here, put its value in its place in the text; 1 if so | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias_expand: called CC=7 SCAR=19.6
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 54 | my $p = pos; @AEXP = grep $$_[1] > $p, @AEXP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 54 | ▶ | /\G([A-Za-z0-9_.\-]+)(?=[ \t\n;&|()<>]|\z)/ or return 0; my $n = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 54 | ▶ | return 0 if grep $$_[0] eq $n, @AEXP; # not again inside its own value | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 54 | ▶ | my $v = alias_at($n, $p); return 0 unless defined $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 21 | ▶ | E("alias '$n' whose value starts with a keyword", $p) if $v =~ /^[ \t]*(\S+)/ && $KW{$1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$v =~ /^[ \t]*(\S+)/ and $Proc::ShellSubset::KW{$1}
MC/DC50%1/2
$v =~ /^[ \t]*(\S+)/ and $Proc::ShellSubset::KW{$1}
$v =~ /^[ \t]*(\S+)/
$Proc::ShellSubset::KW{$1}
Truth table66%2/3
A and B
A= $v =~ /^[ \t]*(\S+)/B= $Proc::ShellSubset::KW{$1}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 19 | substr($_, $p, length $n) = $v; pos = $p; push @AEXP, [$n, $p + length $v]; push @ASH, [$p + length $v, length($v) - length $n]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 19 | ▶ | $ANEXT = $v =~ /[ \t]\z/ ? $p + length $v : undef; 1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 45 | ▶ | sub alias_def { # B1: alias NAME=VALUE / unalias: only as a whole top-level command, so that it surely runs before | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
alias_def: called CC=13 SCAR=25.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 45 | my ($n, $p0, $env, $r, @a) = @_; # the lines after it, where the aliases hold | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 45 | my $before = substr $_, 0, $p0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 45 | ▶ | return $CUT = 1 # P1 (the user, 2026-11-03: "go with better aliases"): whether it runs is known only when it runs, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%12/15
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC and not @$env and not @$r and $before =~ /(?:\A|\n|[^;];)[ \t]*\z/ and /\G[ \t]*(?:#[^\n]*)?(?:\n|;(?!;)|\z)/
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC and not @$env and not @$r and $before =~ /(?:\A|\n|[^;];)[ \t]*\z/
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC and not @$env and not @$r
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC and not @$env
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC
MC/DC50%3/6
@Proc::ShellSubset::OPEN == 4 and not $Proc::ShellSubset::FUNC and not @$env and not @$r and $before =~ /(?:\A|\n|[^;];)[ \t]*\z/ and /\G[ \t]*(?:#[^\n]*)?(?:\n|;(?!;)|\z)/
@Proc::ShellSubset::OPEN == 4
not $Proc::ShellSubset::FUNC
not @$env
not @$r
$before =~ /(?:\A|\n|[^;];)[ \t]*\z/
/\G[ \t]*(?:#[^\n]*)?(?:\n|;(?!;)|\z)/
Truth table57%4/7
A and not(B) and not(C) and not(D) and E and F
A= @Proc::ShellSubset::OPEN == 4B= not $Proc::ShellSubset::FUNCC= not @$envD= not @$rE= $before =~ /(?:\A|\n|[^;];)[ \t]*\z/F= /\G[ \t]*(?:#[^\n]*)?(?:\n|;(?!;)|\z)/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | unless @OPEN == 4 && !$FUNC && !@$env && !@$r && $before =~ /(?:\A|\n|[^;];)[ \t]*\z/ && /\G[ \t]*(?:#[^\n]*)?(?:\n|;(?!;)|\z)/; # so the text after | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 34 | ▶ | my $e = index $_, "\n", pos; $e = length($_) + 1 if $e < 0; # from the next line on | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 34 | ▶ | if ($n eq 'alias') { for (@a) { push @{$ALIAS{$1}}, [$e, $2] if /^([^=]+)=(.*)\z/s } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 6 | ▶ | else { push @{$ALIAS{$_}}, [$e, undef] for $a[0] eq '-a' ? keys %ALIAS : @a } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 4900 | ▶ | sub l_redir { # Proc::ShellSubset's, plus here-documents (F4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_redir: called CC=21 SCAR=30.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 4900 | my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 4900 | ▶ | E('process substitution (bash)', $p) if /\G[<>]\(/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 4894 | ▶ | E('here-string (bash)', $p) if /\G[0-9]*<<</; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 4890 | ▶ | /\G([0-9]*)(<<-?|>>|<>|>\||<&|>&|<|>)$B/gc or return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 210 | ▶ | E('target followed by a redirection operator (dash: a descriptor)', pos) if /\G[0-9]+[<>]/; # x >&2>f (U4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 207 | my ($n, $op) = ($1, $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 207 | ▶ | E('multi-digit descriptor', $p) if length $n > 1 && !$O{fdmulti}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
length $n > 1 and not $Proc::ShellSubset::O{"fdmulti"}
MC/DC0%0/2
length $n > 1 and not $Proc::ShellSubset::O{"fdmulti"}
length $n > 1
not $Proc::ShellSubset::O{"fdmulti"}
Truth table66%2/3
A and not(B)
A= length $n > 1B= not $Proc::ShellSubset::O{"fdmulti"}
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 207 | ▶ | my $fd = length $n ? 0 + $n : $op =~ /^</ ? 0 : 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 207 | ▶ | return [$fd, $op, /\G([0-9-])$END/gc ? $1 : E("'$op' takes one digit or '-'", pos)] if $op =~ /&/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 187 | ▶ | return [$fd, $op, word('r')] if $op !~ /^<</; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 47 | ▶ | /\G($DELIM)/gc or E('missing here-document delimiter', pos); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 47 | ▶ | my $h = shift @HD; $h && $$h[0] eq $1 or E('here-document body not found', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$h and $h->[0] eq $1
MC/DC50%1/2
$h and $h->[0] eq $1
$h
$h->[0] eq $1
Truth table66%2/3
A and B
A= $hB= $h->[0] eq $1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 46 | ▶ | my $bd = $$h[1]; ref $bd or return [$fd, '<<', $bd]; # quoted delimiter: the body is literal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 41 | my @s; local $_ = $$bd[0]; local $M = $$bd[1]; local $NOAT = 1; # as inside "...", but " is ordinary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 41 | ▶ | until (/\G\z/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 69 | ▶ | next if /\G\\\n/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 63 | ▶ | if (/\G(?:([^\\\$`]+)|\\([\$`\\])|(\\))/gc) { push @s, $+ } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 9 | ▶ | elsif (/\G([\$`])/gc) { my $x = $1; bqdq(pos() - 1) if $x eq '`'; push @s, $EX{$x}->('"', pos() - 1) } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 39 | [$fd, '<<', mkword(@s)] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 762 | ▶ | sub l_dollar { # after '$': Proc::ShellSubset's forms, plus $1 $# $@ $* $$ and all POSIX ${...} forms (F1, F2, F9) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_dollar: called CC=19 SCAR=29.5
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 762 | my ($q, $p) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 762 | ▶ | return '$' unless /\G[A-Za-z_0-9{(@*#?\$!\[-]/ or !$q && /\G['"]/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/ or not $q and /\G['"]/
not $q and /\G['"]/
MC/DC100%3/3
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/ or not $q and /\G['"]/
/\G[A-Za-z_0-9{(\@*#?\$!\[-]/
not $q
/\G['"]/
Truth table100%4/4
A or not(B) and C
A= /\G[A-Za-z_0-9{(\@*#?\$!\[-]/B= not $qC= /\G['"]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 756 | ▶ | return [$q . '$((', arith($p)] if /\G\(\(/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 695 | ▶ | if (/\G\(/gc) { local $NOAT; my $l = shell(')', []); /\G\)/gc; return [$q . '$(', $l] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 633 | ▶ | if (/\G(?|\{($PN)\}|($NM|[0-9?!#\$@*]))/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 438 | ▶ | E("'\$\@' where it is not split (dash joins with IFS, bash with blanks)", $p) if $1 eq '@' && $NOAT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$1 eq "\@" and $Proc::ShellSubset::NOAT
MC/DC100%2/2
$1 eq "\@" and $Proc::ShellSubset::NOAT
$1 eq "\@"
$Proc::ShellSubset::NOAT
Truth table100%3/3
A and B
A= $1 eq "\@"B= $Proc::ShellSubset::NOAT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 428 | return [$q . '$', name("$1", $p)] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 195 | ▶ | return [$q . '${#', name("$1", $p)] if /\G\{#($NM|[0-9]+|[#?!\$])\}/gc; # ${##} ${#?} ${#!} ${#$}: both shells (post-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 169 | ▶ | if (!/\G\{#/ && /\G\{($PN)(:?[-+=?]|%%?|##?)/gc) { # not ${##} ${#-} ...: lengths in sh | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not /\G\{#/ and /\G\{($PN)(:?[-+=?]|%%?|##?)/cg
MC/DC100%2/2
not /\G\{#/ and /\G\{($PN)(:?[-+=?]|%%?|##?)/cg
not /\G\{#/
/\G\{($PN)(:?[-+=?]|%%?|##?)/cg
Truth table100%3/3
not(A) and B
A= not /\G\{#/B= /\G\{($PN)(:?[-+=?]|%%?|##?)/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 130 | my ($n, $op) = ($1, $2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 130 | ▶ | E("'\$\@' where it is not split (dash joins with IFS, bash with blanks)", $p) if $n eq '@' && $NOAT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$n eq "\@" and $Proc::ShellSubset::NOAT
MC/DC0%0/2
$n eq "\@" and $Proc::ShellSubset::NOAT
$n eq "\@"
$Proc::ShellSubset::NOAT
Truth table66%2/3
A and B
A= $n eq "\@"B= $Proc::ShellSubset::NOAT
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 130 | ▶ | $op =~ /=/ ? $n =~ /^$NM\z/ ? vname($n, $p) : E("assignment to '\$$n'", $p) : name($n, $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 125 | ▶ | local $NOAT = $NOAT || $q || $op =~ /=/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$Proc::ShellSubset::NOAT || $q || $op =~ /=/
$Proc::ShellSubset::NOAT or $q
MC/DC100%3/3
$Proc::ShellSubset::NOAT || $q || $op =~ /=/
$Proc::ShellSubset::NOAT
$q
$op =~ /=/
Truth table100%4/4
A or B || C
A= $Proc::ShellSubset::NOATB= $qC= $op =~ /=/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 125 | return [$q . '${', $n, $op, pword($q, $op =~ /[%#]/)] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 39 | ▶ | E(/\G['"\[]/ ? 'bash-only $ form' : 'unsupported parameter form', $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 125 | ▶ | sub pword { # the Word of ${NAME OP word}, up to its '}'; $pat: a % or # form, whose Word is a pattern | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pword: called CC=32 SCAR=34.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 125 | my ($q, $pat) = @_; my @s; # [kind, text]: u(nquoted) q(uoted) g(lob character) x(pansion) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 125 | ▶ | until (/\G\}/gc) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 179 | my $p = pos; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 179 | ▶ | next if /\G\\\n/gc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 179 | ▶ | if (/\G([^"'\\~*?\[{}\$`\n]+)/gc) { push @s, [u => $1] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 5 | ▶ | elsif (/\G([\$`])/gc) { my $x = $1; bqdq($p) if $x eq '`' && $q; push @s, [x => $EX{$x}->($q, $p)] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x eq "`" and $q
MC/DC50%1/2
$x eq "`" and $q
$x eq "`"
$q
Truth table66%2/3
A and B
A= $x eq "`"B= $q
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 10 | ▶ | elsif (/\G\\(.)/sgc) { my $c = $1; push @s, $q && !$pat && $c !~ /[\$`"\\}]/ ? [u => "\\$c"] : [q => $c] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$q and not $pat and not $c =~ /[\$`"\\}]/
$q and not $pat
MC/DC66%2/3
$q and not $pat and not $c =~ /[\$`"\\}]/
$q
not $pat
not $c =~ /[\$`"\\}]/
Truth table75%3/4
A and not(B) and not(C)
A= $qB= not $patC= not $c =~ /[\$`"\\}]/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 6 | ▶ | elsif (/\G'/gc) { push @s, $q && !$pat ? [u => "'"] : /\G([^']*)'/gc ? [q => $1] : E('unterminated quote', $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$q and not $pat
MC/DC50%1/2
$q and not $pat
$q
not $pat
Truth table66%2/3
A and not(B)
A= $qB= not $pat
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 16 | elsif (/\G"/gc) { push @s, [q => '']; dq(\@s, $p) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 29 | ▶ | elsif ($pat && /\G([*?])/gc) { push @s, [g => $1] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$pat and /\G([*?])/cg
MC/DC100%2/2
$pat and /\G([*?])/cg
$pat
/\G([*?])/cg
Truth table100%3/3
A and B
A= $patB= /\G([*?])/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 7 | ▶ | elsif ($pat && /\G\[/gc) { push @s, /\G(!?\]?[^\] \t\n;&|()<>'"\\\$`{}^\/,]*\])/gc ? [g => "[$1"] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$pat and /\G\[/cg
MC/DC50%1/2
$pat and /\G\[/cg
$pat
/\G\[/cg
Truth table66%2/3
A and B
A= $patB= /\G\[/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | : bracket(\@s, $p, $q) ? () : [u => '['] } # quotes, expansions inside (post4-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 8 | ▶ | elsif (!$pat && /\G([*?\[])/gc) { push @s, [u => $1] } # ${x:-a?}: active only where the ${...} is unquoted (post4-0.04) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not $pat and /\G([*?\[])/cg
MC/DC50%1/2
not $pat and /\G([*?\[])/cg
not $pat
/\G([*?\[])/cg
Truth table66%2/3
not(A) and B
A= not $patB= /\G([*?\[])/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 4 | ▶ | else { E(/\G\z/ ? "unterminated '\${'" : 'unsupported character in a ${...} word', $p) } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 116 | my $k = join '', map $$_[0], @s; my @v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 116 | ▶ | if ($pat) { push @v, defined $1 ? ['*', join '', map $$_[1], splice @s, 0, length $1] : (shift @s)->[1] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | while $k =~ /([ug]*g[ug]*)|./g } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 62 | ▶ | else { while ($k =~ /(q+)|./g) { my $t = join '', map $$_[1], my @x = splice @s, 0, length($1 // 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$1 // 1
MC/DC100%1/1
$1 // 1
$1
Truth table100%2/2
A
A= $1
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 98 | ▶ | push @v, !defined $1 ? $x[0][1] : $q ? $t : ["'", $t] } } # quoted text in an unquoted ${...}: not split | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 116 | mkword(@v) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 61 | ▶ | sub l_arith { # after '$((': the grammar with assignments; a variable assigned to must be assignable. $( ), `...`, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
l_arith: called CC=17 SCAR=29.8
Pod
undocumented
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 61 | my $p = shift; my ($t, $d, @w) = ('', 0, ''); # ${#NAME} and $((...)) inside are expanded first (P2): then the Word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 61 | ▶ | until (!$d && /\G\)\)/gc) { # of the text and those Parts, else the text alone | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $d and /\G\)\)/cg
MC/DC50%1/2
not $d and /\G\)\)/cg
not $d
/\G\)\)/cg
Truth table66%2/3
not(A) and B
A= not $dB= /\G\)\)/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 94 | ▶ | if (/\G([^()\$`]+)/gc) { $t .= $1; $w[-1] .= $1 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | elsif (/\G\(/gc) { $d++; $t .= '('; $w[-1] .= '(' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | elsif (/\G\)/gc) { --$d >= 0 or E('bad arithmetic expression', $p); $t .= ')'; $w[-1] .= ')' } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 9 | elsif (/\G(\$(?:\{(?:$NM|[0-9]+|[?!#\$])\}|$NM|[0-9?!#\$]))/gc) { $t .= $1; $w[-1] .= $1 } # substituted as text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 12 | ▶ | elsif (/\G(?=\$\(|\$\{#|`)/) { my $x = /\G\$/gc ? '$' : /\G`/gc && '`'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
/\G`/cg and "`"
MC/DC0%0/1
/\G`/cg and "`"
/\G`/cg
Truth table50%1/2
A
A= /\G`/cg
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 12 | push @w, $EX{$x}->('"', pos() - 1), ''; $t .= '1' } # the grammar sees an operand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 2 | else { E('bad arithmetic expression', $p) } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 59 | ▶ | "$t" =~ /^((?&e))(?&w)\z$ARITH/ && $t !~ /\+\+|--/ or E('bad arithmetic expression', $p); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
"$t" =~ /^((?&e))(?&w)\z$ARITH/ and not $t =~ /\+\+|--/
MC/DC100%2/2
"$t" =~ /^((?&e))(?&w)\z$ARITH/ and not $t =~ /\+\+|--/
"$t" =~ /^((?&e))(?&w)\z$ARITH/
not $t =~ /\+\+|--/
Truth table100%3/3
A and not(B)
A= "$t" =~ /^((?&e))(?&w)\z$ARITH/B= not $t =~ /\+\+|--/
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 39 | ▶ | while ($t =~ /\b($NM)(?=[ \t\n]*(?:<<|>>|[-+*\/%&^|])?=(?!=))|\b($NM)/g) { defined $1 ? vname("$1", $p) : name("$2", $p) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 37 | ▶ | @w > 1 ? [grep ref || length, @w] : $w[0] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $_ || length $_
MC/DC100%2/2
ref $_ || length $_
ref $_
length $_
Truth table100%3/3
A || B
A= ref $_B= length $_
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 484 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | __END__ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||