line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/env perl |
2
|
|
|
|
|
|
|
#* |
3
|
|
|
|
|
|
|
#* Info: Ref types definitions module |
4
|
|
|
|
|
|
|
#* Author: Pawel Guspiel (neo77) |
5
|
|
|
|
|
|
|
#* |
6
|
|
|
|
|
|
|
#* This module keeps validation functions. You can of course add your modules which uses this and will add additional checks |
7
|
|
|
|
|
|
|
#* Build in types for Params::Dry |
8
|
|
|
|
|
|
|
#* |
9
|
|
|
|
|
|
|
package Params::Dry::Types::Ref; |
10
|
|
|
|
|
|
|
{ |
11
|
3
|
|
|
3
|
|
1155
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
102
|
|
12
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
79
|
|
13
|
3
|
|
|
3
|
|
15
|
use utf8; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
18
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# --- version --- |
16
|
|
|
|
|
|
|
our $VERSION = 1.20_01; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#=------------------------------------------------------------------------ { use, constants } |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
|
144
|
use Params::Dry::Types qw(:const); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1308
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#=------------------------------------------------------------------------ { module public functions } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#=--------- |
25
|
|
|
|
|
|
|
# Scalar |
26
|
|
|
|
|
|
|
#=--------- |
27
|
|
|
|
|
|
|
#* scalar type check |
28
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
29
|
|
|
|
|
|
|
sub Scalar { |
30
|
2
|
|
|
2
|
1
|
800
|
Params::Dry::Types::Ref( $_[0], 'SCALAR' ); |
31
|
|
|
|
|
|
|
} #+ end of: sub Scalar |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#=-------- |
34
|
|
|
|
|
|
|
# Array |
35
|
|
|
|
|
|
|
#=-------- |
36
|
|
|
|
|
|
|
#* array type check |
37
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
38
|
|
|
|
|
|
|
sub Array { |
39
|
7
|
|
|
7
|
1
|
768
|
Params::Dry::Types::Ref( $_[0], 'ARRAY' ); |
40
|
|
|
|
|
|
|
} #+ end of: sub Array |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#=------- |
43
|
|
|
|
|
|
|
# Hash |
44
|
|
|
|
|
|
|
#=------- |
45
|
|
|
|
|
|
|
#* hash type check |
46
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
47
|
|
|
|
|
|
|
sub Hash { |
48
|
2
|
|
|
2
|
1
|
766
|
Params::Dry::Types::Ref( $_[0], 'HASH' ); |
49
|
|
|
|
|
|
|
} #+ end of: sub Hash |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#=------- |
52
|
|
|
|
|
|
|
# Code |
53
|
|
|
|
|
|
|
#=------- |
54
|
|
|
|
|
|
|
#* code type check |
55
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
56
|
|
|
|
|
|
|
sub Code { |
57
|
2
|
|
|
2
|
1
|
714
|
Params::Dry::Types::Ref( $_[0], 'CODE' ); |
58
|
|
|
|
|
|
|
} #+ end of: sub Code |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
#=------- |
61
|
|
|
|
|
|
|
# Glob |
62
|
|
|
|
|
|
|
#=------- |
63
|
|
|
|
|
|
|
#* glob type check |
64
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
65
|
|
|
|
|
|
|
sub Glob { |
66
|
1
|
|
|
1
|
1
|
435
|
Params::Dry::Types::Ref( $_[0], 'GLOB' ); |
67
|
|
|
|
|
|
|
} #+ end of: sub Glob |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#=------- |
70
|
|
|
|
|
|
|
# Ref |
71
|
|
|
|
|
|
|
#=------- |
72
|
|
|
|
|
|
|
#* Ref to Ref type check |
73
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
74
|
|
|
|
|
|
|
sub Ref { |
75
|
1
|
|
|
1
|
1
|
393
|
Params::Dry::Types::Ref( $_[0], 'REF' ); |
76
|
|
|
|
|
|
|
} #+ end of: sub Ref |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#=--------- |
79
|
|
|
|
|
|
|
# LValue |
80
|
|
|
|
|
|
|
#=--------- |
81
|
|
|
|
|
|
|
#* lvalue type check |
82
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
83
|
|
|
|
|
|
|
sub LValue { |
84
|
1
|
|
|
1
|
1
|
403
|
Params::Dry::Types::Ref( $_[0], 'LVALUE' ); |
85
|
|
|
|
|
|
|
} #+ end of: sub LValue |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#=--------- |
88
|
|
|
|
|
|
|
# Format |
89
|
|
|
|
|
|
|
#=--------- |
90
|
|
|
|
|
|
|
#* format type check |
91
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
92
|
|
|
|
|
|
|
sub Format { |
93
|
1
|
|
|
1
|
1
|
445
|
Params::Dry::Types::Ref( $_[0], 'FORMAT' ); |
94
|
|
|
|
|
|
|
} #+ end of: sub Format |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
#=---------- |
97
|
|
|
|
|
|
|
# VString |
98
|
|
|
|
|
|
|
#=---------- |
99
|
|
|
|
|
|
|
#* glob type check |
100
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
101
|
|
|
|
|
|
|
sub VString { |
102
|
1
|
|
|
1
|
1
|
476
|
Params::Dry::Types::Ref( $_[0], 'VSTRING' ); |
103
|
|
|
|
|
|
|
} #+ end of: sub VString |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
#=--------- |
106
|
|
|
|
|
|
|
# Regexp |
107
|
|
|
|
|
|
|
#=--------- |
108
|
|
|
|
|
|
|
#* glob type check |
109
|
|
|
|
|
|
|
#* RETURN: PASS if test pass otherwise FAIL |
110
|
|
|
|
|
|
|
sub Regexp { |
111
|
2
|
|
|
2
|
1
|
795
|
Params::Dry::Types::Ref( $_[0], 'Regexp' ); |
112
|
|
|
|
|
|
|
} #+ end of: sub Regexp |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
}; |
115
|
|
|
|
|
|
|
0115 && 0x4d; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#+ End of Params::Dry::Types::Ref |
118
|
|
|
|
|
|
|
__END__ |