| 1 | package Data::Unixish::yes; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use 5.010; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use syntax 'each_on_array'; # to support perl < 5.12 | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | #use Log::Any '$log'; | ||||||||||||
| 8 | |||||||||||||
| 9 | 1 | ▶ | use Data::Unixish::Util qw(%common_args); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||
| 12 | 1 | our $DATE = '2025-02-24'; # DATE | |||||||||||
| 13 | 1 | our $DIST = 'Data-Unixish'; # DIST | |||||||||||
| 14 | 1 | our $VERSION = '1.574'; # VERSION | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | our %SPEC; | |||||||||||
| 17 | |||||||||||||
| 18 | $SPEC{yes} = { | ||||||||||||
| 19 | 1 | v => 1.1, | |||||||||||
| 20 | summary => 'Output a string repeatedly until killed', | ||||||||||||
| 21 | description => <<'MARKDOWN', | ||||||||||||
| 22 | |||||||||||||
| 23 | This is like the Unix <prog:yes> utility. | ||||||||||||
| 24 | |||||||||||||
| 25 | MARKDOWN | ||||||||||||
| 26 | args => { | ||||||||||||
| 27 | %common_args, | ||||||||||||
| 28 | string => { | ||||||||||||
| 29 | schema => ['str*', default=>'y'], | ||||||||||||
| 30 | pos => 0, | ||||||||||||
| 31 | greedy => 1, | ||||||||||||
| 32 | }, | ||||||||||||
| 33 | }, | ||||||||||||
| 34 | tags => [qw/text gen-data/], | ||||||||||||
| 35 | 'x.dux.is_stream_output' => 1, # for duxapp < 1.41, will be removed later | ||||||||||||
| 36 | 'x.app.dux.is_stream_output' => 1, | ||||||||||||
| 37 | }; | ||||||||||||
| 38 | 0 | ▶ | sub yes { | ||||||||||
|
Subroutine
yes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 39 | 0 | my %args = @_; | |||||||||||
| 40 | 0 | my ($in, $out) = ($args{in}, $args{out}); | |||||||||||
| 41 | |||||||||||||
| 42 | 0 | ▶ | my $str = $args{string} // 'y'; | ||||||||||
|
Condition0%0/2
$args{"string"} // "y"
MC/DC0%0/1
$args{"string"} // "y"
$args{"string"}
Truth table0%0/2
A
A= $args{"string"}
| |||||||||||||
| 43 | |||||||||||||
| 44 | 0 | while (1) { | |||||||||||
| 45 | 0 | push @$out, $str; | |||||||||||
| 46 | } | ||||||||||||
| 47 | |||||||||||||
| 48 | 0 | [200, "OK"]; | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 1 | 1; | |||||||||||
| 52 | # ABSTRACT: Output a string repeatedly until killed | ||||||||||||
| 53 | |||||||||||||
| 54 | __END__ | ||||||||||||