Value/js/Str/repeat.pm

filter: Statementstmt 72.7% 16 / 22 Branchbran n/a Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 55.5% 20 / 36 CC 3 SCAR 16.6
CC
3
Cov
62%
value
12.0
meta
2.0
BEGIN
1.0
CRAP 5.2
« DefaultValueCommon.pm ↑ Summary Value/perl/Str/repeat.pm »
1 package Data::Sah::Value::js::Str::repeat;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use JSON::MaybeXS;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2024-01-17'; # DATE
11 1 our $DIST = 'Data-Sah-DefaultValue'; # DIST
12 1 our $VERSION = '0.005'; # VERSION
13  
14 0 ▶sub meta {
Subroutine meta: not called CC=1 SCAR=6.9
Pod undocumented
15 +{
16 0 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 0 ▶sub value {
Subroutine value: not called CC=3 SCAR=24.8
Pod undocumented
27 0 my %cargs = @_;
28  
29 0 ▶ my $gen_args = $cargs{args} // {};
Condition0%0/2
$cargs{"args"} // {}
l!l
00
MC/DC0%0/1
$cargs{"args"} // {}
$cargs{"args"}
Truth table0%0/2
A
A= $cargs{"args"}
Aresult
11
00
30 0 my $res = {};
31  
32 0 ▶ $res->{expr_value} = JSON::MaybeXS->new(allow_nonref=>1)->encode($gen_args->{str}) . ".repeat(" . ($gen_args->{n}//1) . ")";
Condition0%0/2
$gen_args->{"n"} // 1
l!l
00
MC/DC0%0/1
$gen_args->{"n"} // 1
$gen_args->{"n"}
Truth table0%0/2
A
A= $gen_args->{"n"}
Aresult
11
00
33  
34 0 $res;
35 }
36  
37 1 1;
38 # ABSTRACT:
39  
40 __END__
« DefaultValueCommon.pm ↑ Summary Value/perl/Str/repeat.pm »