line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
12
|
|
|
12
|
|
70
|
use warnings; |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
328
|
|
4
|
12
|
|
|
12
|
|
53
|
|
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
505
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.48'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use parent 'Specio::Exporter'; |
8
|
12
|
|
|
12
|
|
57
|
|
|
12
|
|
|
|
|
19
|
|
|
12
|
|
|
|
|
62
|
|
9
|
|
|
|
|
|
|
use Specio::Library::String; |
10
|
12
|
|
|
12
|
|
4694
|
use version 0.83 (); |
|
12
|
|
|
|
|
30
|
|
|
12
|
|
|
|
|
90
|
|
11
|
12
|
|
|
12
|
|
5115
|
|
|
12
|
|
|
|
|
20537
|
|
|
12
|
|
|
|
|
356
|
|
12
|
|
|
|
|
|
|
use Specio::Declare; |
13
|
12
|
|
|
12
|
|
82
|
|
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
76
|
|
14
|
|
|
|
|
|
|
my $package_inline = sub { |
15
|
|
|
|
|
|
|
return sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
16
|
|
|
|
|
|
|
( |
17
|
|
|
|
|
|
|
%s |
18
|
|
|
|
|
|
|
&& |
19
|
|
|
|
|
|
|
%s =~ /\A[^\W\d]\w*(?:::\w+)*\z/ |
20
|
|
|
|
|
|
|
) |
21
|
|
|
|
|
|
|
EOF |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
declare( |
25
|
|
|
|
|
|
|
'PackageName', |
26
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
27
|
|
|
|
|
|
|
inline => $package_inline, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
declare( |
31
|
|
|
|
|
|
|
'ModuleName', |
32
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
33
|
|
|
|
|
|
|
inline => $package_inline, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
declare( |
37
|
|
|
|
|
|
|
'DistName', |
38
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
39
|
|
|
|
|
|
|
inline => sub { |
40
|
|
|
|
|
|
|
return |
41
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
42
|
|
|
|
|
|
|
( |
43
|
|
|
|
|
|
|
%s |
44
|
|
|
|
|
|
|
&& |
45
|
|
|
|
|
|
|
%s =~ /\A[^\W\d]\w*(?:-\w+)*\z/ |
46
|
|
|
|
|
|
|
) |
47
|
|
|
|
|
|
|
EOF |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
declare( |
52
|
|
|
|
|
|
|
'Identifier', |
53
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
54
|
|
|
|
|
|
|
inline => sub { |
55
|
|
|
|
|
|
|
return |
56
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
57
|
|
|
|
|
|
|
( |
58
|
|
|
|
|
|
|
%s |
59
|
|
|
|
|
|
|
&& |
60
|
|
|
|
|
|
|
%s =~ /\A[^\W\d]\w*\z/ |
61
|
|
|
|
|
|
|
) |
62
|
|
|
|
|
|
|
EOF |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
declare( |
67
|
|
|
|
|
|
|
'SafeIdentifier', |
68
|
|
|
|
|
|
|
parent => t('Identifier'), |
69
|
|
|
|
|
|
|
inline => sub { |
70
|
|
|
|
|
|
|
return |
71
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
72
|
|
|
|
|
|
|
( |
73
|
|
|
|
|
|
|
%s |
74
|
|
|
|
|
|
|
&& |
75
|
|
|
|
|
|
|
%s !~ /\A[_ab]\z/ |
76
|
|
|
|
|
|
|
) |
77
|
|
|
|
|
|
|
EOF |
78
|
|
|
|
|
|
|
}, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
declare( |
82
|
|
|
|
|
|
|
'LaxVersionStr', |
83
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
84
|
|
|
|
|
|
|
inline => sub { |
85
|
|
|
|
|
|
|
return |
86
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
87
|
|
|
|
|
|
|
( |
88
|
|
|
|
|
|
|
%s |
89
|
|
|
|
|
|
|
&& |
90
|
|
|
|
|
|
|
version::is_lax(%s) |
91
|
|
|
|
|
|
|
) |
92
|
|
|
|
|
|
|
EOF |
93
|
|
|
|
|
|
|
}, |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
declare( |
97
|
|
|
|
|
|
|
'StrictVersionStr', |
98
|
|
|
|
|
|
|
parent => t('NonEmptyStr'), |
99
|
|
|
|
|
|
|
inline => sub { |
100
|
|
|
|
|
|
|
return |
101
|
|
|
|
|
|
|
sprintf( <<'EOF', $_[0]->parent->inline_check( $_[1] ), $_[1] ); |
102
|
|
|
|
|
|
|
( |
103
|
|
|
|
|
|
|
%s |
104
|
|
|
|
|
|
|
&& |
105
|
|
|
|
|
|
|
version::is_strict(%s) |
106
|
|
|
|
|
|
|
) |
107
|
|
|
|
|
|
|
EOF |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# ABSTRACT: Implements type constraint objects for some common Perl language things |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=pod |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=encoding UTF-8 |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 NAME |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Specio::Library::Perl - Implements type constraint objects for some common Perl language things |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 VERSION |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
version 0.48 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 DESCRIPTION |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library provides some additional string types for common cases. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 PackageName |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
A valid package name. Unlike the C<ClassName> constraint from the |
135
|
|
|
|
|
|
|
L<Specio::Library::Builtins> library, this package does not need to be loaded. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This type does allow Unicode characters. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 ModuleName |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Same as C<PackageName>. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 DistName |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
A valid distribution name like C<DBD-Pg> Basically this is the same as a |
146
|
|
|
|
|
|
|
package name with the double-colons replaced by dashes. Note that there are |
147
|
|
|
|
|
|
|
some historical distribution names that don't fit this pattern, like C<CGI.pm>. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This type does allow Unicode characters. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head2 Identifier |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
An L<Identifier|perldata/Variable names> is something that could be used as a |
154
|
|
|
|
|
|
|
symbol name or other identifier (filehandle, directory handle, subroutine name, |
155
|
|
|
|
|
|
|
format name, or label). It's what you put after the sigil (dollar sign, at |
156
|
|
|
|
|
|
|
sign, percent sign) in a variable name. Generally, it's a bunch of word |
157
|
|
|
|
|
|
|
characters not starting with a digit. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This type does allow Unicode characters. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 SafeIdentifier |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
This is just like an C<Identifier> but it excludes the single-character |
164
|
|
|
|
|
|
|
variables underscore (C<_>), C<a>< and C<b>, as these are special variables to |
165
|
|
|
|
|
|
|
the Perl interpreter. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 LaxVersionStr and StrictVersionStr |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Lax and strict version strings use the L<is_lax|version/is_lax> and |
170
|
|
|
|
|
|
|
L<is_strict|version/is_strict> methods from C<version> to check if the given |
171
|
|
|
|
|
|
|
string would be a valid lax or strict version. L<version::Internals> covers the |
172
|
|
|
|
|
|
|
details but basically: lax versions are everything you may do, and strict omit |
173
|
|
|
|
|
|
|
many of the usages best avoided. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 CREDITS |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Much of the code and docs for this library comes from MooseX::Types::Perl, |
178
|
|
|
|
|
|
|
written by Ricardo SIGNES <rjbs@cpan.org>. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 SUPPORT |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head1 SOURCE |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 AUTHOR |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2022 by Dave Rolsky. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This is free software, licensed under: |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
The full text of the license can be found in the |
201
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=cut |