line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IO::Iron::PolicyBase::CharacterGroup; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodAtEnd) |
4
|
|
|
|
|
|
|
## no critic (Documentation::RequirePodSections) |
5
|
|
|
|
|
|
|
## no critic (Subroutines::RequireArgUnpacking) |
6
|
|
|
|
|
|
|
## no critic (Variables::ProhibitPunctuationVars) |
7
|
|
|
|
|
|
|
|
8
|
6
|
|
|
6
|
|
117
|
use 5.010_000; |
|
6
|
|
|
|
|
20
|
|
9
|
6
|
|
|
6
|
|
35
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
146
|
|
10
|
6
|
|
|
6
|
|
61
|
use warnings; |
|
6
|
|
|
|
|
33
|
|
|
6
|
|
|
|
|
171
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Global creator |
13
|
|
|
|
6
|
|
|
BEGIN { |
14
|
|
|
|
|
|
|
# Inherit nothing |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Global destructor |
18
|
|
|
|
6
|
|
|
END { |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# ABSTRACT: Base package (inherited) for IO::Iron::IronMQ/Cache/Worker::Policy packages. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.14'; # VERSION: generated by DZP::OurPkgVersion |
24
|
|
|
|
|
|
|
|
25
|
6
|
|
|
6
|
|
53
|
use Log::Any qw{$log}; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
45
|
|
26
|
6
|
|
|
6
|
|
1276
|
use Params::Validate qw(:all); |
|
6
|
|
|
0
|
|
14
|
|
|
6
|
|
|
|
|
3168
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub group { |
29
|
0
|
|
|
254
|
1
|
0
|
my %params = validate( |
30
|
|
|
|
|
|
|
@_, |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
'character_group' => { type => SCALAR, regex => qr/^[[:graph:]]+$/msx, }, # character group name. |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
); |
35
|
254
|
|
|
|
|
2845
|
my ($group_name) = $params{'character_group'} =~ /\[:([[:graph:]]+):\]/msx; |
36
|
254
|
|
|
|
|
3987
|
$log->tracef( 'group_name=%s;', $group_name ); |
37
|
254
|
100
|
|
|
|
969
|
if ( $group_name eq 'alpha' ) { return alpha(); } ## no critic (ControlStructures::ProhibitCascadingIfElse) |
|
254
|
50
|
|
|
|
18995
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
38
|
3
|
|
|
|
|
8
|
elsif ( $group_name eq 'alnum' ) { return alnum(); } |
39
|
0
|
|
|
|
|
0
|
elsif ( $group_name eq 'digit' ) { return digit(); } |
40
|
14
|
|
|
|
|
38
|
elsif ( $group_name eq 'lower' ) { return lower(); } |
41
|
0
|
|
|
|
|
0
|
elsif ( $group_name eq 'upper' ) { return upper(); } |
42
|
0
|
|
|
|
|
0
|
elsif ( $group_name eq 'word' ) { return word(); } |
43
|
0
|
|
|
|
|
0
|
else { return; } |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub alpha { |
47
|
237
|
|
|
3
|
1
|
820
|
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . 'abcdefghijklmnopqrstuvwxyz'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub alnum { |
51
|
3
|
|
|
0
|
1
|
13
|
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . 'abcdefghijklmnopqrstuvwxyz' . '0123456789'; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub digit { |
55
|
0
|
|
|
14
|
1
|
0
|
return '0123456789'; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub lower { |
59
|
14
|
|
|
0
|
1
|
56
|
return 'abcdefghijklmnopqrstuvwxyz'; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub upper { |
63
|
0
|
|
|
0
|
1
|
|
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub word { |
67
|
0
|
|
|
0
|
1
|
|
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . 'abcdefghijklmnopqrstuvwxyz' . '0123456789_'; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=pod |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=encoding UTF-8 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
IO::Iron::PolicyBase::CharacterGroup - Base package (inherited) for IO::Iron::IronMQ/Cache/Worker::Policy packages. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 VERSION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
version 0.14 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This class is for internal use only. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=for stopwords config Mikko Koivunalho |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=for stopwords alnum abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 FUNCTIONS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 group |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Get the character group. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Parameters: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 8 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item character_group. Full group name, e.g. [:digit:]. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=back |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Return all characters as a string. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 alpha |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Group [:alpha:], ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 alnum |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Group [:alnum:], ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 digit |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Group [:digit:], 0123456789. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 lower |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Group [:lower:], abcdefghijklmnopqrstuvwxyz. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 upper |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Group [:upper:], ABCDEFGHIJKLMNOPQRSTUVWXYZ. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 word |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Group [:word:], ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Mikko Koivunalho <mikko.koivunalho@iki.fi> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 BUGS |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Please report any bugs or feature requests to bug-io-iron@rt.cpan.org or through the web interface at: |
141
|
|
|
|
|
|
|
http://rt.cpan.org/Public/Dist/Display.html?Name=IO-Iron |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This software is copyright (c) 2023 by Mikko Koivunalho. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
148
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
The full text of the license can be found in the |
151
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |