Pad/Completion.pm

filter: Statementstmt 96.9% 161 / 166 Branchbran 90.3% 47 / 52 Conditioncond 67.6% 46 / 68 MC/DCmcdc 50.0% 19 / 38 Subroutinesub 100% 19 / 19 Podpod 30.0% 3 / 10 totaltotal 83.5% 295 / 353 CC 59 SCAR 24.1
CC
59
Cov
89%
candidates
23.4
walk
11.2
optionAwaitingValue
9.2
CRAP 11.1
« Pad.pm ↑ Summary Pad/Util.pm »
1 11 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 11 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 class Getopt::Pad::Completion :strict(params) {
5 11 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶ use File::Basename qw(basename);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶ use List::Util qw(min);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 11 our $VERSION = '0.06';
10  
11 11 ▶ use constant SHELLS => ['bash', 'zsh'];
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶ use constant SHELL_VARIABLE => 'GETOPT_PAD_COMPLETE';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 11 ▶ use constant INDEX_VARIABLE => 'GETOPT_PAD_COMPLETE_INDEX';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # The answer to one request starts with a directive line telling the
16 # shell which of its own completions to add (files, dirs or none),
17 # followed by one candidate per line.
18 11 ▶ use constant NO_DIRECTIVE => 'none';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 11 field $spec :param;
21 field $programName :param = undef;
22  
23 11 ADJUST {
24 $programName //= basename($0);
25 }
26  
27 # The shell scripts are thin: on every tab they run the program with
28 # SHELL_VARIABLE set, the index of the word under the cursor in
29 # INDEX_VARIABLE, and the words after the program name as arguments,
30 # and print what comes back.
31 11 my %scriptTemplate = (
32 bash => <<'BASH',
33 # bash completion for {{prog}}, generated by Getopt::Pad.
34 # Install it as ~/.local/share/bash-completion/completions/{{prog}} or
35 # source it from your ~/.bashrc:
36 # {{prog}} --create-completions bash > ~/.local/share/bash-completion/completions/{{prog}}
37  
38 _{{ident}}_completion() {
39 local -a words=()
40 local cword=0 index word join=0
41  
42 # Bash splits words at '=' (COMP_WORDBREAKS); glue --name=value back together.
43 for ((index = 0; index < ${#COMP_WORDS[@]}; index++)); do
44 word=${COMP_WORDS[index]}
45 if [[ $word == '=' && ${#words[@]} -gt 0 ]]; then
46 words[${#words[@]}-1]+='='
47 join=1
48 elif (( join )); then
49 words[${#words[@]}-1]+=$word
50 join=0
51 else
52 words+=("$word")
53 fi
54 (( index == COMP_CWORD )) && cword=$(( ${#words[@]} - 1 ))
55 done
56  
57 # A read loop: bash 3.2 has no builtin that reads lines into an array.
58 local -a lines=()
59 local line
60 while IFS= read -r line; do
61 lines+=("$line")
62 done < <({{shellVariable}}=bash {{indexVariable}}=$(( cword - 1 )) "${words[0]}" "${words[@]:1}" 2>/dev/null)
63  
64 # The program answers with whole words; bash only replaces the part
65 # after the last '=', so strip what it keeps.
66 local directive=${lines[0]}
67 local cur=${COMP_WORDS[COMP_CWORD]}
68 local prefix=${words[cword]%"$cur"}
69 COMPREPLY=("${lines[@]:1}")
70 COMPREPLY=("${COMPREPLY[@]#"$prefix"}")
71  
72 # Set only now: bash 3.2 joins the quoted array expansions above
73 # into one word when IFS lacks a space.
74 local IFS=$'\n'
75 case $directive in
76 files) compopt -o filenames 2>/dev/null; COMPREPLY+=($(compgen -f -- "$cur")) ;;
77 dirs) compopt -o filenames 2>/dev/null; COMPREPLY+=($(compgen -d -- "$cur")) ;;
78 esac
79 }
80  
81 complete -F _{{ident}}_completion {{prog}}
82 BASH
83 zsh => <<'ZSH',
84 #compdef {{prog}}
85 # zsh completion for {{prog}}, generated by Getopt::Pad.
86 # Install it as _{{prog}} in a directory on your $fpath or source it from
87 # your ~/.zshrc:
88 # {{prog}} --create-completions zsh > ~/.zsh/completions/_{{prog}}
89  
90 _{{ident}}_completion() {
91 local -a lines
92 lines=("${(@f)$({{shellVariable}}=zsh {{indexVariable}}=$(( CURRENT - 2 )) "${words[1]}" "${(@)words[2,-1]}" 2>/dev/null)}")
93  
94 local directive=${lines[1]}
95 shift lines
96 (( ${#lines} )) && compadd -- "${lines[@]}"
97  
98 case $directive in
99 files) compset -P '*='; _files ;;
100 dirs) compset -P '*='; _files -/ ;;
101 esac
102 }
103  
104 if [[ $zsh_eval_context[-1] == loadautofunc ]]; then
105 _{{ident}}_completion "$@"
106 else
107 compdef _{{ident}}_completion {{prog}}
108 fi
109 ZSH
110 );
111  
112 5 ▶ method renderScript($shell) {
Subroutine renderScript: called CC=4 SCAR=14.0
Pod documented
113 5 ▶ my $template = $scriptTemplate{$shell // ''} // croak(sprintf("Getopt::Pad: no completion script for shell '%s'", $shell // ''));
Condition66%4/6
$scriptTemplate{$shell // ""} // croak(sprintf("Getopt::Pad: no completion script for shell '%s'", $shell // ""))
l!l
41
$shell // ""
l!l
50
$shell // ""
l!l
10
MC/DC100%1/1
$scriptTemplate{$shell // ""} // croak(sprintf("Getopt::Pad: no completion script for shell '%s'", $shell // ""))
$scriptTemplate{$shell // ""}
MC/DC0%0/1
$shell // ""
$shell
MC/DC0%0/1
$shell // ""
$shell
Truth table100%2/2
A
A= $scriptTemplate{$shell // ""}
Aresult
11
00
Truth table50%1/2
A
A= $shell
Aresult
11
00
Truth table50%1/2
A
A= $shell
Aresult
11
00
114 4 my %vars = (
115 prog => $programName,
116 ident => $programName =~ s/\W/_/gr,
117 shellVariable => SHELL_VARIABLE,
118 indexVariable => INDEX_VARIABLE,
119 );
120 4 return $template =~ s/\{\{(\w+)\}\}/$vars{$1}/gr;
121 11 }
122  
123 1 ▶ method renderCandidates($words, $index) {
Subroutine renderCandidates: called CC=1 SCAR=0.0
Pod documented
124 1 return join("\n", $self->candidates($words, $index)) . "\n";
125 11 }
126  
127 # The directive and the candidates for the word at $index of the
128 # command line $words (the words after the program name). The word
129 # under the cursor may be partial or missing; the words before it
130 # decide the Level, and whether an Option is waiting for its value.
131 33 ▶ method candidates($words, $index) {
Subroutine candidates: called CC=22 SCAR=31.5
Pod documented
132 33 ▶ croak(sprintf('Getopt::Pad: the completion index must be a non-negative integer, not %s', $index // 'undef')) if ($index // '') !~ /\A\d+\z/;
Branch: 1 branch
BranchTrueFalseTotal
unless ($index // "") =~ /\A\d+\z/u 1 32 33
Condition50%2/4
$index // ""
l!l
330
$index // "undef"
l!l
10
MC/DC0%0/1
$index // ""
$index
MC/DC0%0/1
$index // "undef"
$index
Truth table50%1/2
A
A= $index
Aresult
11
00
Truth table50%1/2
A
A= $index
Aresult
11
00
133  
134 32 ▶ my $current = $words->[$index] // '';
Condition50%1/2
$words->[$index] // ""
l!l
320
MC/DC0%0/1
$words->[$index] // ""
$words->[$index]
Truth table50%1/2
A
A= $words->[$index]
Aresult
11
00
135 32 ▶ my $state = $self->walk([$words->@[0 .. min($index, scalar $words->@*) - 1]]) // return (NO_DIRECTIVE);
Condition100%2/2
$self->walk([@$words[0 .. &min($index, scalar @$words) - 1]]) // (return "none")
l!l
311
MC/DC100%1/1
$self->walk([@$words[0 .. &min($index, scalar @$words) - 1]]) // (return "none")
$self->walk([@$words[0 .. &min($index, scalar @$words) - 1]])
Truth table100%2/2
A
A= $self->walk([@$words[0 .. &min($index, scalar @$words) - 1]])
Aresult
11
00
136 31 my $level = $state->{level};
137  
138 31 my $pending = $state->{valueOption};
139 31 ▶ return $self->valueCandidates($pending, $current, '') if defined $pending && !($pending->optionalValue && $current =~ /^-/);
Branch: 1 branch
BranchTrueFalseTotal
if defined $pending and not $pending->optionalValue && $current =~ /^-/u 14 17 31
Condition50%3/6
defined $pending and not $pending->optionalValue && $current =~ /^-/u
!ll&&!rl&&r
17014
$pending->optionalValue && $current =~ /^-/u
!ll&&!rl&&r
1400
MC/DC33%1/3
defined $pending and not $pending->optionalValue && $current =~ /^-/u
defined $pending $pending->optionalValue $current =~ /^-/u
Truth table50%2/4
A and not(B && C)
A= defined $pendingB= $pending->optionalValueC= $current =~ /^-/u
ABCresult
0XX0
1110
10X1
1101
140  
141 17 ▶ if (!$state->{optionsEnded} && $current =~ /^(--[^=]+)=(.*)$/s) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $state->{"optionsEnded"} and $current =~ /^(--[^=]+)=(.*)$/su) 2 15 17
Condition100%3/3
not $state->{"optionsEnded"} and $current =~ /^(--[^=]+)=(.*)$/su
!ll&&!rl&&r
1142
MC/DC100%2/2
not $state->{"optionsEnded"} and $current =~ /^(--[^=]+)=(.*)$/su
not $state->{"optionsEnded"} $current =~ /^(--[^=]+)=(.*)$/su
Truth table100%3/3
not(A) and B
A= not $state->{"optionsEnded"}B= $current =~ /^(--[^=]+)=(.*)$/su
ABresult
0X0
100
111
142 2 my ($spelling, $partial) = ($1, $2);
143 2 ▶ my $option = $self->longOption($level, $spelling) // return (NO_DIRECTIVE);
Condition50%1/2
$self->longOption($level, $spelling) // (return "none")
l!l
20
MC/DC0%0/1
$self->longOption($level, $spelling) // (return "none")
$self->longOption($level, $spelling)
Truth table50%1/2
A
A= $self->longOption($level, $spelling)
Aresult
11
00
144 2 ▶ return (NO_DIRECTIVE) if !$option->type->takesValue;
Branch: 1 branch
BranchTrueFalseTotal
unless $option->type->takesValue 0 2 2
145 2 return $self->valueCandidates($option, $partial, $spelling . '=');
146 }
147 15 ▶ return $self->optionCandidates($level, $current) if !$state->{optionsEnded} && $current =~ /^-/;
Branch: 1 branch
BranchTrueFalseTotal
if not $state->{"optionsEnded"} and $current =~ /^-/u 5 10 15
Condition100%3/3
not $state->{"optionsEnded"} and $current =~ /^-/u
!ll&&!rl&&r
195
MC/DC100%2/2
not $state->{"optionsEnded"} and $current =~ /^-/u
not $state->{"optionsEnded"} $current =~ /^-/u
Truth table100%3/3
not(A) and B
A= not $state->{"optionsEnded"}B= $current =~ /^-/u
ABresult
0X0
100
111
148 10 ▶ return (NO_DIRECTIVE, grep { $self->startsWith($_, $current) } $level->commandNames) if $level->hasCommands;
Branch: 1 branch
BranchTrueFalseTotal
if $level->hasCommands 4 6 10
149  
150 6 my @args = $level->args;
151 6 ▶ my $arg = $args[$state->{positionals}] // (@args && $args[-1]->multiple ? $args[-1] : undef);
Branch: 1 branch
BranchTrueFalseTotal
@args && $args[-1]->multiple ? : 1 3 4
Condition83%5/6
$args[$state->{"positionals"}] // (@args && $args[-1]->multiple ? $args[-1] : undef)
l!l&&r!l&&!r
213
@args and $args[-1]->multiple
!ll&&!rl&&r
301
MC/DC66%2/3
$args[$state->{"positionals"}] // (@args && $args[-1]->multiple ? $args[-1] : undef)
$args[$state->{"positionals"}] @args $args[-1]->multiple
Truth table75%3/4
A // B and C
A= $args[$state->{"positionals"}]B= @argsC= $args[-1]->multiple
ABCresult
1XX1
0111
00X0
0100
152 6 ▶ return ($arg->type->completes // NO_DIRECTIVE) if defined $arg;
Branch: 1 branch
BranchTrueFalseTotal
if defined $arg 3 3 6
Condition100%2/2
$arg->type->completes // "none"
l!l
12
MC/DC100%1/1
$arg->type->completes // "none"
$arg->type->completes
Truth table100%2/2
A
A= $arg->type->completes
Aresult
11
00
153 3 ▶ return $state->{optionsEnded} ? (NO_DIRECTIVE) : $self->optionCandidates($level, $current);
Branch: 1 branch
BranchTrueFalseTotal
$state->{'optionsEnded'} ? : 0 3 3
154 11 }
155  
156 # Replay the finished words: descend into the named commands, count the
157 # positionals, and remember an Option that still waits for its value.
158 # Returns undef when the words name an unknown command.
159 32 ▶ method walk($words) {
Subroutine walk: called CC=11 SCAR=24.2
Pod undocumented
160 32 my %state = (level => $spec->root, positionals => 0, optionsEnded => 0, valueOption => undef);
161  
162 32 foreach my $word ($words->@*) {
163 47 my $pending = delete $state{valueOption};
164 47 ▶ next if defined $pending && !($pending->optionalValue && $word =~ /^-/);
Branch: 1 branch
BranchTrueFalseTotal
if defined $pending and not $pending->optionalValue && $word =~ /^-/u 1 46 47
Condition50%3/6
defined $pending and not $pending->optionalValue && $word =~ /^-/u
!ll&&!rl&&r
4601
$pending->optionalValue && $word =~ /^-/u
!ll&&!rl&&r
100
MC/DC33%1/3
defined $pending and not $pending->optionalValue && $word =~ /^-/u
defined $pending $pending->optionalValue $word =~ /^-/u
Truth table50%2/4
A and not(B && C)
A= defined $pendingB= $pending->optionalValueC= $word =~ /^-/u
ABCresult
0XX0
1110
10X1
1101
165  
166 46 ▶ if (!$state{optionsEnded} && $word eq '--') {
Branch: 1 branch
BranchTrueFalseTotal
if (not $state{"optionsEnded"} and $word eq "--") 1 45 46
Condition66%2/3
not $state{"optionsEnded"} and $word eq "--"
!ll&&!rl&&r
0451
MC/DC50%1/2
not $state{"optionsEnded"} and $word eq "--"
not $state{"optionsEnded"} $word eq "--"
Truth table66%2/3
not(A) and B
A= not $state{"optionsEnded"}B= $word eq "--"
ABresult
0X0
100
111
167 1 $state{optionsEnded} = 1;
168 1 next;
169 }
170 45 ▶ if (!$state{optionsEnded} && $word =~ /^-/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $state{"optionsEnded"} and $word =~ /^-/u) 17 28 45
Condition66%2/3
not $state{"optionsEnded"} and $word =~ /^-/u
!ll&&!rl&&r
02817
MC/DC50%1/2
not $state{"optionsEnded"} and $word =~ /^-/u
not $state{"optionsEnded"} $word =~ /^-/u
Truth table66%2/3
not(A) and B
A= not $state{"optionsEnded"}B= $word =~ /^-/u
ABresult
0X0
100
111
171 17 $state{valueOption} = $self->optionAwaitingValue($state{level}, $word);
172 17 next;
173 }
174 28 ▶ if ($state{level}->hasCommands) {
Branch: 1 branch
BranchTrueFalseTotal
if ($state{"level"}->hasCommands) 24 4 28
175 24 ▶ $state{level} = $state{level}->command($word) // return undef;
Condition100%2/2
$state{"level"}->command($word) // (return undef)
l!l
231
MC/DC100%1/1
$state{"level"}->command($word) // (return undef)
$state{"level"}->command($word)
Truth table100%2/2
A
A= $state{"level"}->command($word)
Aresult
11
00
176 23 next;
177 }
178 4 $state{positionals}++;
179 }
180  
181 31 return \%state;
182 11 }
183  
184 # The Option that takes the word after $word as its value, or undef when
185 # the word carries its value itself, is a flag, or is unknown.
186 17 ▶ method optionAwaitingValue($level, $word) {
Subroutine optionAwaitingValue: called CC=9 SCAR=22.2
Pod undocumented
187 17 ▶ return undef if $word =~ /^--[^=]+=/;
Branch: 1 branch
BranchTrueFalseTotal
if $word =~ /^--[^=]+=/u 0 17 17
188 17 ▶ if ($word =~ /^--/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($word =~ /^--/u) 14 3 17
189 14 ▶ my $option = $self->longOption($level, $word) // return undef;
Condition50%1/2
$self->longOption($level, $word) // (return undef)
l!l
140
MC/DC0%0/1
$self->longOption($level, $word) // (return undef)
$self->longOption($level, $word)
Truth table50%1/2
A
A= $self->longOption($level, $word)
Aresult
11
00
190 14 ▶ return $option->type->takesValue ? $option : undef;
Branch: 1 branch
BranchTrueFalseTotal
$option->type->takesValue ? : 13 1 14
191 }
192  
193 # A cluster of single-letter names: the first one taking a value
194 # swallows the rest of the cluster, or the next word if none is left.
195 3 my @letters = split //, substr($word, 1);
196 3 foreach my $position (0 .. $#letters) {
197 4 ▶ my $option = $self->optionBySpelling($level, $letters[$position]) // next;
Condition50%1/2
$self->optionBySpelling($level, $letters[$position]) // (next)
l!l
40
MC/DC0%0/1
$self->optionBySpelling($level, $letters[$position]) // (next)
$self->optionBySpelling($level, $letters[$position])
Truth table50%1/2
A
A= $self->optionBySpelling($level, $letters[$position])
Aresult
11
00
198 4 ▶ next if !$option->type->takesValue;
Branch: 1 branch
BranchTrueFalseTotal
unless $option->type->takesValue 1 3 4
199 3 ▶ return $position == $#letters ? $option : undef;
Branch: 1 branch
BranchTrueFalseTotal
$position == $#letters ? : 2 1 3
200 }
201 0 return undef;
202 11 }
203  
204 16 ▶ method longOption($level, $spelling) {
Subroutine longOption: called CC=4 SCAR=19.1
Pod undocumented
205 16 my $name = $spelling =~ s/^--//r;
206 16 ▶ return $self->optionBySpelling($level, $name) // do {
Condition33%1/3
$self->optionBySpelling($level, $name) // do { my $negated = $name =~ s/^no-//ru; my $option = $self->optionBySpelling($level, $negated); defined $option && $option->negatable ? $option : undef }
l!l&&r!l&&!r
1600
MC/DC0%0/2
$self->optionBySpelling($level, $name) // do { my $negated = $name =~ s/^no-//ru; my $option = $self->optionBySpelling($level, $negated); defined $option && $option->negatable ? $option : undef }
$self->optionBySpelling($level, $name) do { my $negated = $name =~ s/^no-//ru; my $option = $self->optionBySpelling($level, $negated); defined $option && $option->negatable ? $option : undef }
Truth table33%1/3
A // B
A= $self->optionBySpelling($level, $name)B= do { my $negated = $name =~ s/^no-//ru; my $option = $self->optionBySpelling($level, $negated); defined $option && $option->negatable ? $option : undef }
ABresult
1X1
011
000
207 0 my $negated = $name =~ s/^no-//r;
208 0 my $option = $self->optionBySpelling($level, $negated);
209 0 ▶ defined $option && $option->negatable ? $option : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $option && $option->negatable ? : 0 0 0
Condition0%0/3
defined $option and $option->negatable
!ll&&!rl&&r
000
MC/DC0%0/2
defined $option and $option->negatable
defined $option $option->negatable
Truth table0%0/3
A and B
A= defined $optionB= $option->negatable
ABresult
0X0
100
111
210 };
211 11 }
212  
213 20 ▶ method optionBySpelling($level, $name) {
Subroutine optionBySpelling: called CC=3 SCAR=11.0
Pod undocumented
214 20 foreach my $option ($level->options) {
215 74 ▶ return $option if grep { $_ eq $name } $option->name, $option->aliases;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_ eq $name;} $option->name, $option->aliases 20 54 74
216 }
217 0 return undef;
218 11 }
219  
220 8 ▶ method optionCandidates($level, $partial) {
Subroutine optionCandidates: called CC=6 SCAR=17.9
Pod undocumented
221 8 my @spellings;
222 8 foreach my $option (grep { !$_->hidden } $level->options) {
223 35 foreach my $name ($option->name, $option->aliases) {
224 50 ▶ push @spellings, length $name == 1 ? "-$name" : "--$name";
Branch: 1 branch
BranchTrueFalseTotal
length $name == 1 ? : 15 35 50
225 50 ▶ push @spellings, "--no-$name" if $option->negatable && length $name > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $option->negatable and length $name > 1 2 48 50
Condition100%3/3
$option->negatable and length $name > 1
!ll&&!rl&&r
4622
MC/DC100%2/2
$option->negatable and length $name > 1
$option->negatable length $name > 1
Truth table100%3/3
A and B
A= $option->negatableB= length $name > 1
ABresult
0X0
100
111
226 }
227 }
228 8 return (NO_DIRECTIVE, sort grep { $self->startsWith($_, $partial) } @spellings);
229 11 }
230  
231 # A pair-taking option's value is key=value, a csv option's a,b,...;
232 # the candidates fill in the value behind what the user has typed.
233 16 ▶ method valueCandidates($option, $partial, $prefix) {
Subroutine valueCandidates: called CC=6 SCAR=17.9
Pod undocumented
234 16 ▶ if ($option->takesPairs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option->takesPairs) 4 12 16
235 4 ▶ return (NO_DIRECTIVE) if $partial !~ /^([^=]*=)(.*)$/s;
Branch: 1 branch
BranchTrueFalseTotal
unless $partial =~ /^([^=]*=)(.*)$/su 1 3 4
236 3 ($prefix, $partial) = ($prefix . $1, $2);
237 }
238 15 ▶ if ($option->csv && $partial =~ /^(.*,)(.*)$/s) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option->csv and $partial =~ /^(.*,)(.*)$/su) 1 14 15
Condition100%3/3
$option->csv and $partial =~ /^(.*,)(.*)$/su
!ll&&!rl&&r
1311
MC/DC100%2/2
$option->csv and $partial =~ /^(.*,)(.*)$/su
$option->csv $partial =~ /^(.*,)(.*)$/su
Truth table100%3/3
A and B
A= $option->csvB= $partial =~ /^(.*,)(.*)$/su
ABresult
0X0
100
111
239 1 ($prefix, $partial) = ($prefix . $1, $2);
240 }
241  
242 15 ▶ my $directive = $option->type->completes // NO_DIRECTIVE;
Condition100%2/2
$option->type->completes // "none"
l!l
114
MC/DC100%1/1
$option->type->completes // "none"
$option->type->completes
Truth table100%2/2
A
A= $option->type->completes
Aresult
11
00
243 15 return ($directive, map { $prefix . $_ } sort grep { $self->startsWith($_, $partial) } $option->validValues);
244 11 }
245  
246 93 ▶ method startsWith($string, $prefix) {
Subroutine startsWith: called CC=2 SCAR=6.9
Pod undocumented
247 93 ▶ return index($string, $prefix) == 0 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
index($string, $prefix) == 0 ? : 75 18 93
248 11 }
249 }
250  
251 11 1;
252  
253 __END__
« Pad.pm ↑ Summary Pad/Util.pm »