Value/perl/Str/repeat.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 83.3% 30 / 36 CC 3 SCAR 5.8
CC
3
Cov
92%
value
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Value/js/Str/repeat.pm ↑ Summary Value/js/Math/random.pm »
1 package Data::Sah::Value::perl::Str::repeat;
2  
3 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Data::Dmp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 2 our $DATE = '2024-01-17'; # DATE
11 2 our $DIST = 'Data-Sah-DefaultValue'; # DIST
12 2 our $VERSION = '0.005'; # VERSION
13  
14 2 ▶sub meta {
Subroutine meta: called CC=1 SCAR=0.0
Pod undocumented
15 +{
16 2 v => 1,
17 summary => 'Repeat a string a number of times',
18 prio => 50,
19 args => {
20 str => {schema=>'str*', req=>1},
21 n => {schema=>'uint*', default=>1},
22 },
23 };
24 }
25  
26 2 ▶sub value {
Subroutine value: called CC=3 SCAR=11.3
Pod undocumented
27 2 my %cargs = @_;
28  
29 2 ▶ my $gen_args = $cargs{args} // {};
Condition50%1/2
$cargs{"args"} // {}
l!l
20
MC/DC0%0/1
$cargs{"args"} // {}
$cargs{"args"}
Truth table50%1/2
A
A= $cargs{"args"}
Aresult
11
00
30 2 my $res = {};
31  
32 2 ▶ $res->{expr_value} = dmp($gen_args->{str}) . " x " . ($gen_args->{n}//1);
Condition50%1/2
$gen_args->{"n"} // 1
l!l
20
MC/DC0%0/1
$gen_args->{"n"} // 1
$gen_args->{"n"}
Truth table50%1/2
A
A= $gen_args->{"n"}
Aresult
11
00
33  
34 2 $res;
35 }
36  
37 2 1;
38 # ABSTRACT:
39  
40 __END__
« Value/js/Str/repeat.pm ↑ Summary Value/js/Math/random.pm »