line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Specio::Library::String; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
93
|
use strict; |
|
12
|
|
|
|
|
28
|
|
|
12
|
|
|
|
|
350
|
|
4
|
12
|
|
|
12
|
|
62
|
use warnings; |
|
12
|
|
|
|
|
31
|
|
|
12
|
|
|
|
|
489
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.47'; |
7
|
|
|
|
|
|
|
|
8
|
12
|
|
|
12
|
|
66
|
use parent 'Specio::Exporter'; |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
79
|
|
9
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
922
|
use Specio::Declare; |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
81
|
|
11
|
12
|
|
|
12
|
|
84
|
use Specio::Library::Builtins; |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
75
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
declare( |
14
|
|
|
|
|
|
|
'NonEmptySimpleStr', |
15
|
|
|
|
|
|
|
parent => t('Str'), |
16
|
|
|
|
|
|
|
inline => sub { |
17
|
|
|
|
|
|
|
return |
18
|
|
|
|
|
|
|
sprintf( |
19
|
|
|
|
|
|
|
<<'EOF', $_[0]->parent->inline_check( $_[1] ), ( $_[1] ) x 3 ); |
20
|
|
|
|
|
|
|
( |
21
|
|
|
|
|
|
|
%s |
22
|
|
|
|
|
|
|
&& |
23
|
|
|
|
|
|
|
length %s > 0 |
24
|
|
|
|
|
|
|
&& |
25
|
|
|
|
|
|
|
length %s <= 255 |
26
|
|
|
|
|
|
|
&& |
27
|
|
|
|
|
|
|
%s !~ /[\n\r\x{2028}\x{2029}]/ |
28
|
|
|
|
|
|
|
) |
29
|
|
|
|
|
|
|
EOF |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
declare( |
34
|
|
|
|
|
|
|
'NonEmptyStr', |
35
|
|
|
|
|
|
|
parent => t('Str'), |
36
|
|
|
|
|
|
|
inline => sub { |
37
|
|
|
|
|
|
|
return |
38
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
39
|
|
|
|
|
|
|
( |
40
|
|
|
|
|
|
|
%s |
41
|
|
|
|
|
|
|
&& |
42
|
|
|
|
|
|
|
length %s |
43
|
|
|
|
|
|
|
) |
44
|
|
|
|
|
|
|
EOF |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
declare( |
49
|
|
|
|
|
|
|
'SimpleStr', |
50
|
|
|
|
|
|
|
parent => t('Str'), |
51
|
|
|
|
|
|
|
inline => sub { |
52
|
|
|
|
|
|
|
return |
53
|
|
|
|
|
|
|
sprintf( |
54
|
|
|
|
|
|
|
<<'EOF', $_[0]->parent->inline_check( $_[1] ), ( $_[1] ) x 2 ); |
55
|
|
|
|
|
|
|
( |
56
|
|
|
|
|
|
|
%s |
57
|
|
|
|
|
|
|
&& |
58
|
|
|
|
|
|
|
length %s <= 255 |
59
|
|
|
|
|
|
|
&& |
60
|
|
|
|
|
|
|
%s !~ /[\n\r\x{2028}\x{2029}]/ |
61
|
|
|
|
|
|
|
) |
62
|
|
|
|
|
|
|
EOF |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# ABSTRACT: Implements type constraint objects for some common string types |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Specio::Library::String - Implements type constraint objects for some common string types |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 0.47 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This library provides some additional string types for common cases. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 NonEmptyStr |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
A string which has at least one character. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 SimpleStr |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
A string that is 255 characters or less with no vertical whitespace characters. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 NonEmptySimpleStr |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
A non-empty string that is 255 characters or less with no vertical whitespace |
99
|
|
|
|
|
|
|
characters. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SUPPORT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SOURCE |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2021 by Dave Rolsky. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This is free software, licensed under: |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The full text of the license can be found in the |
124
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |