File Coverage

blib/lib/Data/Sah/Filter/perl/Str/replace_underscores_with_dashes.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package Data::Sah::Filter::perl::Str::replace_underscores_with_dashes;
2              
3 1     1   1453 use 5.010001;
  1         4  
4 1     1   5 use strict;
  1         2  
  1         18  
5 1     1   4 use warnings;
  1         1  
  1         146  
6              
7             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8             our $DATE = '2022-07-16'; # DATE
9             our $DIST = 'Data-Sah-Filter-perl-Str-replace_underscores_with_dashes'; # DIST
10             our $VERSION = '0.002'; # VERSION
11              
12             sub meta {
13             +{
14 1     1 0 13 v => 1,
15             summary => 'Replace underscores in string with dashes',
16             examples => [
17             {value=>'foo'},
18             {value=>'foo_bar', filtered_value=>'foo-bar'},
19             ],
20             description => <<'_',
21              
22             This is mostly created as a counterpart for the replace_dashes_with_underscores
23             filter (). So
24             far I haven't got a practical use for this.
25              
26             _
27             };
28             }
29              
30             sub filter {
31 1     1 0 15 my %args = @_;
32              
33 1         2 my $dt = $args{data_term};
34              
35 1         2 my $res = {};
36 1         3 $res->{expr_filter} = join(
37             "",
38             "do { my \$tmp = $dt; \$tmp =~ s/_/-/g; \$tmp }",
39             );
40              
41 1         3 $res;
42             }
43              
44             1;
45             # ABSTRACT: Replace underscores in string with dashes
46              
47             __END__