line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Sah::Coerce::perl::To_str::From_str::trim; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# AUTHOR |
4
|
|
|
|
|
|
|
our $DATE = '2020-02-11'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Data-Sah-Coerce-perl-To_str-From_str-trim'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.007'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2156
|
use 5.010001; |
|
1
|
|
|
|
|
8
|
|
9
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
177
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub meta { |
13
|
|
|
|
|
|
|
+{ |
14
|
1
|
|
|
1
|
0
|
14
|
v => 4, |
15
|
|
|
|
|
|
|
summary => '(DEPRECATED) Trim whitespaces at the beginning and end of string', |
16
|
|
|
|
|
|
|
prio => 50, |
17
|
|
|
|
|
|
|
precludes => ['From_str::ltrim', 'From_str::rtrim'], |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub coerce { |
22
|
1
|
|
|
1
|
0
|
17
|
my %args = @_; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
2
|
my $dt = $args{data_term}; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
2
|
my $res = {}; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
4
|
$res->{expr_match} = "!ref($dt)"; |
29
|
1
|
|
|
|
|
3
|
$res->{expr_coerce} = join( |
30
|
|
|
|
|
|
|
"", |
31
|
|
|
|
|
|
|
"do { my \$res = $dt; \$res =~ s/\\A\\s+//s; \$res =~ s/\\s+\\z//s; \$res }", |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
3
|
$res; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
# ABSTRACT: (DEPRECATED) Trim whitespaces at the beginning and end of string |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=encoding UTF-8 |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Data::Sah::Coerce::perl::To_str::From_str::trim - (DEPRECATED) Trim whitespaces at the beginning and end of string |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This document describes version 0.007 of Data::Sah::Coerce::perl::To_str::From_str::trim (from Perl distribution Data-Sah-Coerce-perl-To_str-From_str-trim), released on 2020-02-11. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SYNOPSIS |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
To use in a Sah schema: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
["str",{"x.perl.coerce_rules"=>["From_str::trim"]}] |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
DEPRECATION NOTICE: Using L<Data::Sah::Filter::perl::Str::trim> is now more |
63
|
|
|
|
|
|
|
appropriate as multiple filters can be applied to data. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=for Pod::Coverage ^(meta|coerce)$ |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 HOMEPAGE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah-Coerce-perl-To_str-From_str-trim>. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 SOURCE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah-Coerce-perl-To_str-From_str-trim>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 BUGS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
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-To_str-From_str-trim> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
80
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
81
|
|
|
|
|
|
|
feature. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This software is copyright (c) 2020, 2019, 2018 by perlancar@cpan.org. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |