File Coverage

blib/lib/Data/Sah/Coerce/perl/str/str_ltrim.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 20 22 90.9


line stmt bran cond sub pod time code
1             package Data::Sah::Coerce::perl::str::str_ltrim;
2              
3             our $DATE = '2019-07-26'; # DATE
4             our $VERSION = '0.004'; # VERSION
5              
6 1     1   11439 use 5.010001;
  1         3  
7 1     1   6 use strict;
  1         2  
  1         22  
8 1     1   3 use warnings;
  1         2  
  1         123  
9              
10             sub meta {
11             +{
12 1     1 0 11 v => 4,
13             prio => 50,
14             };
15             }
16              
17             sub coerce {
18 1     1 0 14 my %args = @_;
19              
20 1         3 my $dt = $args{data_term};
21              
22 1         1 my $res = {};
23              
24 1         3 $res->{expr_match} = "!ref($dt)";
25 1         3 $res->{expr_coerce} = join(
26             "",
27             "do { my \$res = $dt; \$res =~ s/\\A\\s+//s; \$res }",
28             );
29              
30 1         3 $res;
31             }
32              
33             1;
34             # ABSTRACT: Trim whitespaces at the beginning of string
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             Data::Sah::Coerce::perl::str::str_ltrim - Trim whitespaces at the beginning of string
45              
46             =head1 VERSION
47              
48             This document describes version 0.004 of Data::Sah::Coerce::perl::str::str_ltrim (from Perl distribution Data-Sah-Coerce-perl-str-str_trim), released on 2019-07-26.
49              
50             =head1 DESCRIPTION
51              
52             The rule is not enabled by default. You can enable it in a schema using e.g.:
53              
54             ["str", "x.perl.coerce_rules"=>["str_ltrim"]]
55              
56             =for Pod::Coverage ^(meta|coerce)$
57              
58             =head1 HOMEPAGE
59              
60             Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah-Coerce-perl-str-str_trim>.
61              
62             =head1 SOURCE
63              
64             Source repository is at L<https://github.com/perlancar/perl-Data-Sah-Coerce-perl-str-str_trim>.
65              
66             =head1 BUGS
67              
68             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Coerce-perl-str-str_trim>
69              
70             When submitting a bug or request, please include a test-file or a
71             patch to an existing test-file that illustrates the bug or desired
72             feature.
73              
74             =head1 AUTHOR
75              
76             perlancar <perlancar@cpan.org>
77              
78             =head1 COPYRIGHT AND LICENSE
79              
80             This software is copyright (c) 2019, 2018 by perlancar@cpan.org.
81              
82             This is free software; you can redistribute it and/or modify it under
83             the same terms as the Perl 5 programming language system itself.
84              
85             =cut