| 1 | package Proc::ShellSpawn::Builtins; # builtins run by the large subset: one function per builtin (B1-B3 of "Shell Corpus Gaps") | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 481 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 481 | ▶ | use strict; use warnings; use feature 'current_sub'; | ||||||||||||||||||||||||||||||||||||||||
|
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 | 481 | ▶ | use Proc::ShellSpawn; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 481 | ▶ | BEGIN { no strict 'refs'; *$_ = \&{"Proc::ShellSpawn::$_"} for qw(defer fail msg put var spawn find_cmd) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # A builtin counts as implemented when its entry is here; Proc::ShellSpawn looks command names up in | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # @Proc::ShellSpawn::CMDS, where this table comes first. Each handler: NAME->(CONTEXT, ARGV, ENV, K), calls K once. | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 481 | our %CMD = ((map +($_ => [__PACKAGE__ . "::b_$_"]), qw(alias unalias jobs fg bg hash type times ulimit)), | |||||||||||||||||||||||||||||||||||||||||
| 10 | (map +($_ => [__PACKAGE__ . '::b_interactive']), qw(history fc bind help compopt logout))); | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 481 | unshift @Proc::ShellSpawn::CMDS, \%CMD; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 52 | ▶ | sub done { my ($k, $st) = @_; sub { $k->($st) } } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
done: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | sub sq { my $v = shift; my $o = ''; # as dash quotes values in listings: 'a'"'"'b'; a leading quote gives ''"'"... | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sq: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | while (1) { $v =~ /\G([^']*)/gc; $o .= "'$1'"; last unless $v =~ /\G('+)/gc; $o .= qq("$1"); last if pos $v == length $v } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | $o } | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | # ------------------------------------------------------------------ B1: alias, unalias | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # The parser expands aliases in the lines after their definition; here the table is kept for eval and '.' texts. | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 26 | ▶ | sub b_alias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_alias: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 26 | my ($c, $argv, $env, $k) = @_; my $al = $c->{sh}{alias}; my @a = @$argv[1 .. $#$argv]; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 26 | ▶ | return Proc::ShellSpawn::Large::unsupported($c, "'alias' in the text of eval or '.'") if $c->{sh}{intext}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 26 | ▶ | return put($c, 1, join('', map "$_=" . sq($al->{$_}) . "\n", sort keys %$al), done($k, 0)) unless @a; # dash: hash order | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 23 | my ($out, $err) = ('', ''); | |||||||||||||||||||||||||||||||||||||||||
| 25 | 23 | ▶ | for (@a) { if (/^([^=]+)=(.*)\z/s) { $al->{$1} = $2 } elsif (exists $al->{$_}) { $out .= "$_=" . sq($al->{$_}) . "\n" } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | else { $err .= "alias: $_ not found\n" } } | |||||||||||||||||||||||||||||||||||||||||
| 27 | 23 | ▶ | put($c, 1, $out, sub { put($c, 2, $err, done($k, $err ne '' ? 1 : 0)) }) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 4 | ▶ | sub b_unalias { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_unalias: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | my ($c, $argv, $env, $k) = @_; my $al = $c->{sh}{alias}; my @a = @$argv[1 .. $#$argv]; | |||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | ▶ | return Proc::ShellSpawn::Large::unsupported($c, "'unalias' in the text of eval or '.'") if $c->{sh}{intext}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | ▶ | if ($a[0] eq '-a') { %$al = (); return defer($k, 0) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | ▶ | my $err = ''; for (@a) { exists $al->{$_} ? delete $al->{$_} : ($err .= "unalias: $_ not found\n") } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | put($c, 2, $err, done($k, $err ne '' ? 1 : 0)) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | # ------------------------------------------------------------------ B2: interactive-only builtins | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub b_interactive { # nothing (the default), or as dash, which has none of them: a program by that name, or not found | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_interactive: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my ($c, $argv, $env, $k) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | $c->{sh}{interactive} eq 'dash' ? spawn($c, $c->{map}, $argv, $env, $k) : defer($k, 0) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # ------------------------------------------------------------------ B3: as dash | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 11 | ▶ | sub b_jobs { # dash's format in sh -c: "[N] + Running", padded to column 33, without the command's text; -l adds the | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_jobs: called CC=12 SCAR=25.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | # process ID, -p prints it alone. In a pipeline element or $( ) the shell's jobs are listed too, as bash does (rule E) | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # Operands %N, %%, %+, %- (post-0.04) list those jobs, in that order; one that does not exist: dash's message, status 2. | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 11 | my ($c, $argv, $env, $k) = @_; my @a = @$argv[1 .. $#$argv]; my $f = ''; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 11 | ▶ | $f .= $1 while @a && $a[0] =~ /^-([lp]+)\z/ && shift @a; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@a and $a[0] =~ /^-([lp]+)\z/ and shift @a
@a and $a[0] =~ /^-([lp]+)\z/
MC/DC66%2/3
@a and $a[0] =~ /^-([lp]+)\z/ and shift @a
@a
$a[0] =~ /^-([lp]+)\z/
shift @a
Truth table75%3/4
A and B and C
A= @aB= $a[0] =~ /^-([lp]+)\z/C= shift @a
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 11 | ▶ | my @j = (@{$c->{sh}{ljobs} // []}, @{$c->{sh}{jobl}}); my $st = 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$c->{"sh"}{"ljobs"} // []
MC/DC100%1/1
$c->{"sh"}{"ljobs"} // []
$c->{"sh"}{"ljobs"}
Truth table100%2/2
A
A= $c->{"sh"}{"ljobs"}
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 19 | ▶ | my $line = sub { my $i = shift; my $pid = $j[$i]{first} // $j[$i]{pids}[0] // 0; return "$pid\n" if $f =~ /p/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=7 SCAR=20.7
Branch: 1 branch
Condition40%2/5
($j[$i]{"first"} // $j[$i]{"pids"}[0]) // 0
$j[$i]{"first"} // $j[$i]{"pids"}[0]
MC/DC0%0/2
($j[$i]{"first"} // $j[$i]{"pids"}[0]) // 0
$j[$i]{"first"}
$j[$i]{"pids"}[0]
Truth table33%1/3
A // B
A= $j[$i]{"first"}B= $j[$i]{"pids"}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 14 | ▶ | my $h = sprintf "[%d] %s %s", $i + 1, $i == $#j ? '+' : $i == $#j - 1 ? '-' : ' ', $f =~ /l/ ? "$pid " : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 11 | sprintf "%s%-*s\n", $h, 33 - length $h, 'Running' }; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 11 | my @out = map +[1, $line->($_)], grep !defined $j[$_]{st}, 0 .. $#j; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 11 | ▶ | if (@a) { @out = (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | ▶ | for (@a) { my $i = /^%([0-9]+)\z/ ? $1 - 1 : $_ eq '%-' ? $#j - 1 : $#j; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | ▶ | if ($i >= 0 && $i <= $#j && !defined $j[$i]{st}) { push @out, [1, $line->($i)] } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$i >= 0 and $i <= $#j and not defined $j[$i]{"st"}
$i >= 0 and $i <= $#j
MC/DC33%1/3
$i >= 0 and $i <= $#j and not defined $j[$i]{"st"}
$i >= 0
$i <= $#j
not defined $j[$i]{"st"}
Truth table50%2/4
A and B and not(C)
A= $i >= 0B= $i <= $#jC= not defined $j[$i]{"st"}
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | else { push @out, [2, "jobs: No such job: $_"]; $st = 2 } } } | |||||||||||||||||||||||||||||||||||||||||
| 55 | 21 | ▶ | sub { my $next = __SUB__; my $o = shift @out or return $k->($st); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 11 | ▶ | $o->[0] == 1 ? put($c, 1, $o->[1], $next) : msg($c, $o->[1], $next) }->() } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 3 | ▶ | sub b_bg { my ($c, $argv, $env, $k) = @_; my $j = $argv->[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_bg: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 3 | ▶ | msg($c, defined $j ? "$argv->[0]: job $j not created under job control" : "$argv->[0]: No current job", done($k, 2)) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 481 | *b_fg = \&b_bg; | |||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | 481 | my %DASHBI = map +($_ => 1), qw(. : [ alias bg break cd chdir command continue echo eval exec exit export false fg getopts hash | |||||||||||||||||||||||||||||||||||||||||
| 62 | jobs kill local printf pwd read readonly return set shift test times trap true type ulimit umask unalias unset wait); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 481 | my %DASHKW = map +($_ => 1), qw(! { } case do done elif else esac fi for if in then until while); | |||||||||||||||||||||||||||||||||||||||||
| 64 | 6 | ▶ | sub b_hash { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_hash: called CC=9 SCAR=22.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 6 | my ($c, $argv, $env, $k) = @_; my $h = $c->{sh}{hash}; my @a = @$argv[1 .. $#$argv]; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 6 | ▶ | return put($c, 1, join('', map "$h->{$_}\n", sort keys %$h), done($k, 0)) unless @a; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 3 | ▶ | if ($a[0] eq '-r') { %$h = (); return defer($k, 0) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | my @bad; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | ▶ | for (@a) { next if $DASHBI{$_} || $c->{sh}{cmd}{$_}; my ($p) = find_cmd($c, $_, var($c, 'PATH')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$DASHBI{$_} or $c->{"sh"}{"cmd"}{$_}
MC/DC0%0/2
$DASHBI{$_} or $c->{"sh"}{"cmd"}{$_}
$DASHBI{$_}
$c->{"sh"}{"cmd"}{$_}
Truth table33%1/3
A or B
A= $DASHBI{$_}B= $c->{"sh"}{"cmd"}{$_}
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | ▶ | if (defined $p) { $h->{$_} = $p unless Proc::ShellSpawn::has_dir($_) } else { push @bad, $_ } } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 2 | ▶ | my $st = @bad ? 1 : 0; # one message per name not found, each after the one before | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | ▶ | sub { my $next = __SUB__; @bad ? msg($c, "hash: " . shift(@bad) . ": not found", $next) : $k->($st) }->() } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 5 | ▶ | sub b_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_type: called CC=13 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 5 | my ($c, $argv, $env, $k) = @_; my $sh = $c->{sh}; my ($t, $st) = ('', 0); | |||||||||||||||||||||||||||||||||||||||||
| 75 | 5 | for my $n (@$argv[1 .. $#$argv]) { | |||||||||||||||||||||||||||||||||||||||||
| 76 | 9 | ▶ | if ($DASHKW{$n}) { $t .= "$n is a shell keyword\n" } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | elsif (exists $sh->{alias}{$n}) { $t .= "$n is an alias for $sh->{alias}{$n}\n" } | |||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | elsif ($sh->{cmd}{$n}) { $t .= "$n is a shell function\n" } | |||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | elsif ($Proc::ShellSpawn::SPECIAL{$n}) { $t .= "$n is a special shell builtin\n" } | |||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | elsif ($DASHBI{$n}) { $t .= "$n is a shell builtin\n" } | |||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | ▶ | elsif (!Proc::ShellSpawn::has_dir($n) && $sh->{hash}{$n}) { $t .= "$n is a tracked alias for $sh->{hash}{$n}\n" } | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not Proc::ShellSpawn::has_dir($n) and $sh->{"hash"}{$n}
MC/DC100%2/2
not Proc::ShellSpawn::has_dir($n) and $sh->{"hash"}{$n}
not Proc::ShellSpawn::has_dir($n)
$sh->{"hash"}{$n}
Truth table100%3/3
not(A) and B
A= not Proc::ShellSpawn::has_dir($n)B= $sh->{"hash"}{$n}
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 3 | ▶ | else { my ($p) = Proc::ShellSpawn::has_dir($n) ? (-x Proc::ShellSpawn::path_in($c, $n) && !-d _ ? $n : undef) : find_cmd($c, $n, var($c, 'PATH')); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
-x Proc::ShellSpawn::path_in($c, $n) and not -d _
MC/DC0%0/2
-x Proc::ShellSpawn::path_in($c, $n) and not -d _
-x Proc::ShellSpawn::path_in($c, $n)
not -d _
Truth table33%1/3
A and not(B)
A= -x Proc::ShellSpawn::path_in($c, $n)B= not -d _
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | ▶ | if (defined $p) { $t .= "$n is $p\n" } else { $t .= "$n: not found\n"; $st = 127 } } } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 5 | put($c, 1, $t, done($k, $st)) } | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub b_times { # the shell's own and its children's user and system time | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_times: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my ($c, $argv, $env, $k) = @_; my @t = times; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | my $f = sub { my $s = shift; sprintf '%dm%.6fs', int($s / 60), $s - 60 * int($s / 60) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | put($c, 1, join(' ', map $f->($_), @t[0, 1]) . "\n" . join(' ', map $f->($_), @t[2, 3]) . "\n", done($k, 0)) } | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | # ulimit, reading only: dash's letters and units; the limits of this Perl process, from getrlimit (Proc::Spawner's | ||||||||||||||||||||||||||||||||||||||||||
| 91 | # XSUB; post-0.08: before, /proc/self/limits or a shell's ulimit). POSIX units: blocks of 512 bytes for -f and -c, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | # KiB for -s -d -m -l -v. | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 481 | my %UL = (t => ['CPU', 1], f => ['FSIZE', 512], d => ['DATA', 1024], s => ['STACK', 1024], c => ['CORE', 512], | |||||||||||||||||||||||||||||||||||||||||
| 94 | m => ['RSS', 1024], l => ['MEMLOCK', 1024], n => ['NOFILE', 1], v => ['AS', 1024]); | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 12 | ▶ | sub b_ulimit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
b_ulimit: called CC=10 SCAR=23.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 12 | my ($c, $argv, $env, $k) = @_; my ($hard, $r) = (0, 'f'); | |||||||||||||||||||||||||||||||||||||||||
| 97 | 12 | ▶ | for (@$argv[1 .. $#$argv]) { $hard = 1 if /H[a-zA-Z]*\z/ && !/S[^H]*\z/; $r = $1 if /([nsctvlmdf])/ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
/H[a-zA-Z]*\z/ and not /S[^H]*\z/
MC/DC50%1/2
/H[a-zA-Z]*\z/ and not /S[^H]*\z/
/H[a-zA-Z]*\z/
not /S[^H]*\z/
Truth table66%2/3
A and not(B)
A= /H[a-zA-Z]*\z/B= not /S[^H]*\z/
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 12 | my ($name, $div) = @{$UL{$r}}; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 12 | ▶ | my %res = defined &Proc::Spawner::__rlimits ? Proc::Spawner::__rlimits() : (); # (none on Windows) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 12 | ▶ | my @v = defined $res{$name} ? Proc::Spawner::__getrlimit($res{$name}) : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 12 | require Proc::ShellSpawn::Large; # (unsupported lives there; this module may run without it) | |||||||||||||||||||||||||||||||||||||||||
| 102 | 12 | ▶ | return Proc::ShellSpawn::Large::unsupported($c, "'ulimit -$r'") unless @v; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 12 | ▶ | my $v = $v[$hard ? 1 : 0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 12 | ▶ | put($c, 1, ($v eq 'unlimited' ? $v : int($v / $div)) . "\n", done($k, 0)) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 481 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 107 | __END__ | ||||||||||||||||||||||||||||||||||||||||||