File Coverage

blib/lib/Data/Sah/Value/perl/Str/repeat.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition 2 4 50.0
subroutine 6 6 100.0
pod 0 2 0.0
total 25 29 86.2


line stmt bran cond sub pod time code
1             package Data::Sah::Value::perl::Str::repeat;
2              
3 2     2   253845 use 5.010001;
  2         10  
4 2     2   24 use strict;
  2         3  
  2         44  
5 2     2   5 use warnings;
  2         4  
  2         112  
6              
7 2     2   1258 use Data::Dmp;
  2         4231  
  2         390  
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2024-01-17'; # DATE
11             our $DIST = 'Data-Sah-DefaultValue'; # DIST
12             our $VERSION = '0.005'; # VERSION
13              
14             sub meta {
15             +{
16 2     2 0 12 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             sub value {
27 2     2 0 5 my %cargs = @_;
28              
29 2   50     3 my $gen_args = $cargs{args} // {};
30 2         3 my $res = {};
31              
32 2   50     4 $res->{expr_value} = dmp($gen_args->{str}) . " x " . ($gen_args->{n}//1);
33              
34 2         78 $res;
35             }
36              
37             1;
38             # ABSTRACT:
39              
40             __END__