blib/lib/Kook/Util.pm

filter: Statementstmt 95.3% 205 / 215 Branchbran 79.5% 97 / 122 Conditioncond 83.3% 15 / 18 MC/DCmcdc 63.6% 7 / 11 Subroutinesub 100% 25 / 25 Podpod 0.0% 0 / 11 totaltotal 86.8% 349 / 402 CC 76 SCAR 27.9
CC
76
Cov
89%
_parse
35.0
meta2rexp
12.5
_listup
12.2
CRAP 16.2
« blib/lib/Kook/Main.pm ↑ Summary blib/lib/Kook/Recipe.pm »
1 ###
2 ### $Release: 0.0100 $
3 ### $Copyright: copyright(c) 2009-2011 kuwata-lab.com all rights reserved. $
4 ### $License: MIT License $
5 ###
6  
7 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 package Kook::Util;
12 40 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 40 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
14 40 our @EXPORT_OK = qw(read_file write_file ob_start ob_get_clean has_metachar meta2rexp repr flatten first glob2 mtime);
15  
16 53 ▶sub read_file {
Subroutine read_file: called CC=2 SCAR=7.0
Pod undocumented
17 53 my ($filename) = @_;
18 53 ▶ open my $fh, '<', $filename or die "$filename: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $filename or die "${filename}: $!\n" 53 0 53
19 53 read $fh, my $s, (-s $filename);
20 53 close $fh;
21 53 return $s;
22 }
23  
24 10 ▶sub write_file {
Subroutine write_file: called CC=2 SCAR=7.0
Pod undocumented
25 10 my ($filename, $content) = @_;
26 10 ▶ open my $fh, '>', $filename or die "$filename: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $filename or die "${filename}: $!\n" 10 0 10
27 10 print $fh $content;
28 10 close $fh;
29 }
30  
31 40 my $_ob_buf_;
32  
33 2 ▶sub ob_start {
Subroutine ob_start: called CC=2 SCAR=7.2
Pod undocumented
34 2 ▶ open(MEM, ">", \$_ob_buf_) or die;
Branch: 1 branch
BranchTrueFalseTotal
open MEM, ">", \$_ob_buf_ or die 2 0 2
35 2 select(MEM);
36 }
37  
38 2 ▶sub ob_get_clean {
Subroutine ob_get_clean: called CC=1 SCAR=0.0
Pod undocumented
39 2 select(STDOUT);
40 2 return $_ob_buf_;
41 }
42  
43 256 ▶sub has_metachar {
Subroutine has_metachar: called CC=1 SCAR=0.0
Pod undocumented
44 256 my ($str) = @_;
45 256 $str =~ s/\\.//g;
46 256 return $str =~ /[\*\?\{]/
47 #my @chars = split "", $str;
48 #for (my $i = 0, my $n = length($str); $i < $n; $i++) {
49 # my $c = $chars[$i];
50 # if ($c eq '\\') {
51 # $i++;
52 # }
53 # elsif ($c eq '*' || $c eq '?' || $c eq '{') {
54 # return 1;
55 # }
56 #}
57 #return;
58 #my @chars = split "", $str;
59 #var $skip = 0;
60 #for my $c (@chars) {
61 # if ($skip) { $skip = 0; }
62 # elsif ($c eq "\\") { $skip = 1; }
63 # elsif ($c eq '*' || $c eq '?' || $c eq '{') {
64 # return 1;
65 # }
66 #}
67 #return;
68 }
69  
70 55 ▶sub meta2rexp {
Subroutine meta2rexp: called CC=12 SCAR=25.2
Pod undocumented
71 55 my ($pattern) = @_;
72 55 my $n = length $pattern;
73 55 my @chars = split "", $pattern;
74 55 my @buf = ('^');
75 55 ▶ for (my $i = 0; $i < $n; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $n) 214 55 269
76 214 my $ch = $chars[$i];
77 214 ▶ if ($ch eq '\\') {
Branch: 4 branches
BranchTrueFalseTotal
if ($ch eq '\\') { } 0 214 214
elsif ($ch eq '*') { } 52 162 214
elsif ($ch eq '?') { } 2 160 162
elsif ($ch eq '{') { } 3 157 160
78 0 $i++;
79 0 ▶ $i < $n or die "'$pattern': invalid backslash.";
Branch: 1 branch
BranchTrueFalseTotal
$i < $n or die "'${pattern}': invalid backslash." 0 0 0
80 0 $ch = $chars[$i];
81 0 push @buf, $ch;
82 }
83 elsif ($ch eq '*') {
84 52 push @buf, '(.*?)';
85 }
86 elsif ($ch eq '?') {
87 2 push @buf, '(';
88 2 ▶ while ($i < $n && $ch eq '?') {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $n and $ch eq "?") 4 2 6
Condition100%3/3
$i < $n and $ch eq "?"
!ll&&!rl&&r
114
MC/DC100%2/2
$i < $n and $ch eq "?"
$i < $n $ch eq "?"
Truth table100%3/3
A and B
A= $i < $nB= $ch eq "?"
ABresult
0X0
100
111
89 4 push @buf, '.';
90 4 $i++;
91 4 $ch = $chars[$i];
92 }
93 2 push @buf, ')';
94 2 $i--;
95 }
96 elsif ($ch eq '{') {
97 3 my $left = $i;
98 3 my $right;
99 3 $i++;
100 3 ▶ while ($i < $n) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $n) 34 0 34
101 34 $ch = $chars[$i];
102 34 ▶ if ($ch eq '}') {
Branch: 1 branch
BranchTrueFalseTotal
if ($ch eq "}") 3 31 34
103 3 $right = $i;
104 3 last;
105 }
106 31 $i++;
107 }
108 3 ▶ $right or die "$pattern: '{' is not closed by '}'.";
Branch: 1 branch
BranchTrueFalseTotal
$right or die "${pattern}: '{' is not closed by '}'." 3 0 3
109 3 my $words_str = substr $pattern, $left+1, $right-$left-1;
110 3 my @words = split /,/, $words_str; #/;
111 3 my @arr = map { quotemeta($_) } @words;
112 3 push @buf, '(', join('|', @arr), ')';
113 }
114 else {
115 157 push @buf, quotemeta($ch);
116 }
117 }
118 55 push @buf, '$';
119 55 return join '', @buf;
120 }
121  
122 49 ▶sub repr {
Subroutine repr: called CC=1 SCAR=0.0
Pod undocumented
123 49 my ($val) = @_;
124 49 my $d = Data::Dumper->new([$val]);
125 49 $d->Indent(0)->Terse(1)->Useqq(1);
126 49 return $d->Dump;
127 }
128  
129 ##
130 ## ex.
131 ## my $arr = ["foo", ["bar", ["baz"]]];
132 ## my @arr2 = flatten @$arr;
133 ## print repr(\@arr2); #=> ["foo", "bar", "baz"]
134 ##
135 79 ▶sub flatten {
Subroutine flatten: called CC=1 SCAR=0.0
Pod undocumented
136 79 my $buf = [];
137 79 _flatten($buf, @_);
138 79 return @$buf;
139 }
140  
141 81 ▶sub _flatten {
Subroutine _flatten: called CC=3 SCAR=11.0
142 81 my $buf = shift @_;
143 81 for (@_) {
144 153 ▶ ref($_) eq 'ARRAY' ? _flatten($buf, @$_) : push(@$buf, $_);
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'ARRAY' ? : 2 151 153
145 }
146 }
147  
148 1 ▶sub first(&@) {
Subroutine first: called CC=3 SCAR=11.1
Pod undocumented
149 1 my ($block, @arr) = @_;
150 1 for (@arr) {
151 2 ▶ return $_ if $block->($_);
Branch: 1 branch
BranchTrueFalseTotal
if &$block($_) 1 1 2
152 }
153 0 return;
154 }
155  
156 216 ▶sub glob2 {
Subroutine glob2: called CC=7 SCAR=19.5
Pod undocumented
157 216 my ($pattern) = @_;
158 216 my @pair = split /\*\*\//, $pattern, 2;
159 216 ▶ return glob($pattern) if @pair == 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if @pair == 1 203 13 216
160 13 my ($dirpat, $basepat) = @pair;
161 #$dirpat && $dirpat =~ /\/$/ ? $dirpat =~ s/\/$//
162 # : $dirpat .= '*';
163 13 ▶ if ($dirpat && $dirpat =~ /\/$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dirpat and $dirpat =~ m[/$]) { } 10 3 13
Condition66%2/3
$dirpat and $dirpat =~ m[/$]
!ll&&!rl&&r
3010
MC/DC50%1/2
$dirpat and $dirpat =~ m[/$]
$dirpat $dirpat =~ m[/$]
Truth table66%2/3
A and B
A= $dirpatB= $dirpat =~ m[/$]
ABresult
0X0
100
111
164 10 $dirpat =~ s/\/$//;
165 }
166 else {
167 3 $dirpat .= '*';
168 }
169 13 ▶ my @filenames = $dirpat eq '*' ? glob($basepat) : ();
Branch: 1 branch
BranchTrueFalseTotal
$dirpat eq '*' ? : 3 10 13
170 13 for my $path (glob($dirpat)) {
171 19 my @dirlist = _listup($path, 'd');
172 19 for my $dir (@dirlist) {
173 65 my @entries = glob2("$dir/$basepat");
174 65 push @filenames, @entries;
175 }
176 }
177 13 return @filenames;
178 }
179  
180 110 ▶sub _listup {
Subroutine _listup: called CC=11 SCAR=25.0
181 110 my ($path, $kind, $arr) = @_;
182 110 ▶ $arr = [] unless $arr;
Branch: 1 branch
BranchTrueFalseTotal
unless $arr 19 91 110
183 0 ▶ if ($kind eq 'f') { push @$arr, $path if -f $path; }
Branch: 3 branches
BranchTrueFalseTotal
if ($kind eq 'f') { } 0 110 110
elsif ($kind eq 'd') { } 110 0 110
if -f $path 0 0 0
184 110 ▶ elsif ($kind eq 'd') { push @$arr, $path if -d $path; }
Branch: 1 branch
BranchTrueFalseTotal
if -d $path 65 45 110
185 0 else { push @$arr, $path; }
186 110 ▶ if (-d $path) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $path) 65 45 110
187 65 ▶ opendir DIR, $path or die "opendir: $path: $!";
Branch: 1 branch
BranchTrueFalseTotal
opendir DIR, $path or die "opendir: ${path}: $!" 65 0 65
188 65 my @entries = readdir DIR;
189 65 closedir DIR;
190 65 for my $e (@entries) {
191 221 ▶ next if $e eq '.' || $e eq '..';
Branch: 1 branch
BranchTrueFalseTotal
if $e eq "." or $e eq ".." 130 91 221
Condition100%3/3
$e eq "." or $e eq ".."
l!l&&r!l&&!r
656591
MC/DC100%2/2
$e eq "." or $e eq ".."
$e eq "." $e eq ".."
Truth table100%3/3
A or B
A= $e eq "."B= $e eq ".."
ABresult
1X1
011
000
192 91 _listup("$path/$e", $kind, $arr);
193 }
194 }
195 110 return @$arr;
196 }
197  
198 141 ▶sub mtime {
Subroutine mtime: called CC=1 SCAR=0.0
Pod undocumented
199 141 my ($filename) = @_;
200 141 return (stat $filename)[9];
201 }
202  
203  
204 package Kook::Util::CommandOptionParser;
205 40 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
206  
207 46 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
208 46 my ($class, $optdef_strs) = @_;
209 46 my $this = {
210 optdef_strs => $optdef_strs,
211 };
212 46 $this = bless $this, $class;
213 46 $this->parse_optdefs($optdef_strs);
214 46 return $this;
215 }
216  
217 46 ▶sub parse_optdefs {
Subroutine parse_optdefs: called CC=6 SCAR=18.0
218 46 my ($this, $optdef_strs) = @_;
219 46 my $helps = [];
220 46 my $optdefs = {};
221 46 for my $optdef_str (@$optdef_strs) {
222 465 my ($opt, $desc) = split /:/, $optdef_str, 2; #/;
223 465 $desc =~ s/^\s+//;
224 465 $desc =~ s/\s+$//;
225 465 my @pair = ($opt, $desc);
226 465 push @$helps, \@pair;
227 465 ▶ if ($opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/ ||
Branch: 1 branch
BranchTrueFalseTotal
if ($opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/ or $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/) { } 465 0 465
Condition66%2/3
$opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/ or $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/
l!l&&r!l&&!r
378870
MC/DC0%0/2
$opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/ or $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/
$opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/ $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/
Truth table66%2/3
A or B
A= $opt =~ /^-(\w)(?:\s+(.+)|\[(\w+)\])?$/B= $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/
ABresult
1X1
011
000
228 $opt =~ /^--([a-zA-Z][-\w]+)(?:=(.+)|\[=(.+)\])?$/ ) {
229 465 my ($name, $arg1, $arg2) = ($1, $2, $3);
230 465 ▶ if ($arg1) { $optdefs->{$name} = $arg1; }
Branch: 2 branches
BranchTrueFalseTotal
if ($arg1) { } 94 371 465
elsif ($arg2) { } 54 317 371
231 54 elsif ($arg2) { $optdefs->{$name} = "[$arg2]"; }
232 317 else { $optdefs->{$name} = 1; }
233 }
234 else {
235 0 die "$opt: invalid command option definition.";
236 }
237 }
238 46 $this->{optdefs} = $optdefs;
239 46 $this->{helps} = $helps;
240 46 return $optdefs, $helps;
241 }
242  
243 8 ▶sub parse {
Subroutine parse: called CC=1 SCAR=0.0
244 8 my ($this, $cmd_args, $command) = @_;
245 8 my ($opts, $rests) = $this->_parse($cmd_args, $command, 1);
246 6 return $opts, $rests;
247 }
248  
249 34 ▶sub parse2 {
Subroutine parse2: called CC=1 SCAR=0.0
250 34 my ($this, $cmd_args, $command) = @_;
251 34 my ($opts, $longopts, $rests) = $this->_parse($cmd_args, $command, 0);
252 32 return $opts, $longopts, $rests;
253 }
254  
255 42 ▶sub _parse {
Subroutine _parse: called CC=34 SCAR=35.6
256 42 my ($this, $cmd_args, $command, $check_longopts) = @_;
257 42 my $optdefs = $this->{optdefs};
258 42 my $opts = {};
259 42 my $longopts = {};
260 42 my $N = @$cmd_args;
261 42 my $i;
262 42 ▶ for ($i = 0; $i < $N; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $N) 71 8 79
263 71 my $cmd_arg = $cmd_args->[$i];
264 71 ▶ if ($cmd_arg eq "--") {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd_arg eq "--") 1 70 71
265 1 $i++;
266 1 last;
267 }
268 ## long opts
269 70 ▶ if ($cmd_arg =~ /^--/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cmd_arg =~ /^--/) { } 12 58 70
elsif ($cmd_arg =~ /^-/) { } 29 29 58
270 12 ▶ $cmd_arg =~ /^--([a-zA-Z_][-\w]+)(?:=(.*))?$/ or
Branch: 1 branch
BranchTrueFalseTotal
$cmd_arg =~ /^--([a-zA-Z_][-\w]+)(?:=(.*))?$/ or die "${cmd_arg}: invalid option.\n" 12 0 12
271 die "$cmd_arg: invalid option.\n";
272 12 my $name = $1;
273 12 my $arg = $2;
274 12 ▶ if (! $check_longopts) {
Branch: 6 branches
BranchTrueFalseTotal
if (not $check_longopts) { } 4 8 12
elsif (not exists $optdefs->{$name}) { } 0 8 8
elsif ($optdefs->{$name} eq 1) { } 1 7 8
elsif ($optdefs->{$name} eq '[N]') { } 2 5 7
elsif ($optdefs->{$name} =~ /^\[.*?\]$/) { } 2 3 5
elsif ($optdefs->{$name} eq 'N') { } 1 2 3
275 4 ▶ $arg = 1 unless $arg;
Branch: 1 branch
BranchTrueFalseTotal
unless $arg 1 3 4
276 4 $longopts->{$name} = $arg;
277 }
278 elsif (! exists $optdefs->{$name}) {
279 0 die "$cmd_arg: unknown command option.\n";
280 }
281 elsif ($optdefs->{$name} eq 1) { # --name
282 1 ▶ ! $arg or die "$cmd_arg: argument is not allowed.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg and die "${cmd_arg}: argument is not allowed.\n" 0 1 1
283 1 $opts->{$name} = 1;
284 }
285 elsif ($optdefs->{$name} eq "[N]") { # --name[=N]
286 2 ▶ if ($arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg) { } 1 1 2
287 1 ▶ $arg =~ /^[-+]?(\d+)$/ or die "$cmd_arg: integer required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /^[-+]?(\d+)$/ or die "${cmd_arg}: integer required.\n" 1 0 1
288 #$arg = 0 + $arg;
289 }
290 else {
291 1 $arg = 1;
292 }
293 2 $opts->{$name} = $arg;
294 }
295 elsif ($optdefs->{$name} =~ /^\[.*?\]$/) { # --name[=arg]
296 2 ▶ $opts->{$name} = $arg || 1;
Condition100%2/2
$arg || 1
l!l
11
MC/DC100%1/1
$arg || 1
$arg
Truth table100%2/2
A
A= $arg
Aresult
11
00
297 }
298 elsif ($optdefs->{$name} eq "N") { # --name=N
299 1 ▶ $arg or die "$cmd_arg: argument required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg or die "${cmd_arg}: argument required.\n" 1 0 1
300 1 ▶ $arg =~ /^\d+$/ or die "$cmd_arg: integer required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /^\d+$/ or die "${cmd_arg}: integer required.\n" 1 0 1
301 #$opts->{$name} = 0 + $arg;
302 1 $opts->{$name} = $arg;
303 }
304 else { # --name=arg
305 2 ▶ $arg or die "$cmd_arg: argument required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg or die "${cmd_arg}: argument required.\n" 2 0 2
306 2 $opts->{$name} = $arg;
307 }
308 }
309 ## short ops
310 elsif ($cmd_arg =~ /^-/) {
311 29 my @optchars = split "", $cmd_arg;
312 29 my $n = @optchars;
313 29 ▶ for (my $j = 1; $j < $n; $j++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $n) 38 8 46
314 38 my $ch = $optchars[$j];
315 38 ▶ if (! exists $optdefs->{$ch}) {
Branch: 4 branches
BranchTrueFalseTotal
if (not exists $optdefs->{$ch}) { } 0 38 38
elsif ($optdefs->{$ch} eq 1) { } 17 21 38
elsif ($optdefs->{$ch} eq '[N]') { } 8 13 21
elsif ($optdefs->{$ch} =~ /^\[.*\]$/) { } 1 12 13
316 0 die "-$ch: unknown command option.\n";
317 }
318 elsif ($optdefs->{$ch} eq 1) { # -x
319 17 $opts->{$ch} = 1;
320 17 next;
321 }
322 elsif ($optdefs->{$ch} eq "[N]") { # -x[N]
323 8 my $arg = substr($cmd_arg, $j+1);
324 8 ▶ if ($arg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg) 5 3 8
325 5 ▶ $arg =~ /^\d+$/ or die "-$ch$arg: integer required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /^\d+$/ or die "-$ch${arg}: integer required.\n" 3 2 5
326 }
327 #$opts->{$ch} = $arg ? 0 + $arg : "true";
328 6 ▶ $opts->{$ch} = $arg || 1;
Condition100%2/2
$arg || 1
l!l
33
MC/DC100%1/1
$arg || 1
$arg
Truth table100%2/2
A
A= $arg
Aresult
11
00
329 6 last;
330 }
331 elsif ($optdefs->{$ch} =~ /^\[.*\]$/) { # -x[arg]
332 1 ▶ $opts->{$ch} = substr($cmd_arg, $j+1) || 1;
Condition50%1/2
substr($cmd_arg, $j + 1) || 1
l!l
10
MC/DC0%0/1
substr($cmd_arg, $j + 1) || 1
substr($cmd_arg, $j + 1)
Truth table50%1/2
A
A= substr($cmd_arg, $j + 1)
Aresult
11
00
333 1 last;
334 }
335 else { # -x arg
336 12 my $arg = substr($cmd_arg, $j+1);
337 12 ▶ if (! $arg) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($arg) 9 3 12
338 #assert $j+1 == $n;
339 9 $i++; # not $j
340 9 ▶ $i < $N or die "-$ch: ".$optdefs->{$ch}." required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$i < $N or die "-${ch}: " . $optdefs->{$ch} . " required.\n" 7 2 9
341 7 $arg = $cmd_args->[$i];
342 }
343 10 ▶ if ($optdefs->{$ch} eq "N") { # -x N
Branch: 1 branch
BranchTrueFalseTotal
if ($optdefs->{$ch} eq "N") 1 9 10
344 1 ▶ $arg =~ /^\d+$/ or die "-$ch $arg: integer required.\n";
Branch: 1 branch
BranchTrueFalseTotal
$arg =~ /^\d+$/ or die "-$ch ${arg}: integer required.\n" 1 0 1
345 #$arg = 0 + $arg;
346 }
347 10 $opts->{$ch} = $arg;
348 10 last;
349 }
350 }
351 }
352 ## short ops
353 else {
354 29 last;
355 }
356 }
357 ##
358 38 my @rests = splice @$cmd_args, $i;
359 38 ▶ return $opts, \@rests if $check_longopts;
Branch: 1 branch
BranchTrueFalseTotal
if $check_longopts 6 32 38
360 32 return $opts, $longopts, \@rests;
361 }
362  
363 2 ▶sub help {
Subroutine help: called CC=4 SCAR=14.0
364 2 my ($this, $command, $format) = @_;
365 2 ▶ $format = " %-20s: %s\n" unless $format;
Branch: 1 branch
BranchTrueFalseTotal
unless $format 2 0 2
366 2 my @buf = ();
367 2 for my $pair (@{$this->{helps}}) {
368 22 my ($optdef_str, $desc) = @$pair;
369 22 ▶ push @buf, sprintf($format, $optdef_str, $desc) if $desc;
Branch: 1 branch
BranchTrueFalseTotal
if $desc 22 0 22
370 }
371 2 return join "", @buf;
372 }
373  
374  
375 40 1;
« blib/lib/Kook/Main.pm ↑ Summary blib/lib/Kook/Recipe.pm »