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 1     1   22 use 5.010001;
  1         4  
4 1     1   5 use strict;
  1         2  
  1         19  
5 1     1   5 use warnings;
  1         2  
  1         22  
6              
7 1     1   529 use Data::Dmp;
  1         2147  
  1         203  
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2023-01-20'; # DATE
11             our $DIST = 'Data-Sah-DefaultValue'; # DIST
12             our $VERSION = '0.002'; # VERSION
13              
14             sub meta {
15             +{
16 1     1 0 10 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 1     1 0 3 my %cargs = @_;
28              
29 1   50     6 my $gen_args = $cargs{args} // {};
30 1         2 my $res = {};
31              
32 1   50     3 $res->{expr_value} = dmp($gen_args->{str}) . " x " . ($gen_args->{n}//1);
33              
34 1         51 $res;
35             }
36              
37             1;
38             # ABSTRACT:
39              
40             __END__