| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Poz::Builder; |
|
2
|
11
|
|
|
11
|
|
162
|
use 5.032; |
|
|
11
|
|
|
|
|
40
|
|
|
3
|
11
|
|
|
11
|
|
51
|
use strict; |
|
|
11
|
|
|
|
|
16
|
|
|
|
11
|
|
|
|
|
224
|
|
|
4
|
11
|
|
|
11
|
|
36
|
use warnings; |
|
|
11
|
|
|
|
|
15
|
|
|
|
11
|
|
|
|
|
576
|
|
|
5
|
11
|
|
|
11
|
|
4658
|
use Poz::Types::null; |
|
|
11
|
|
|
|
|
34
|
|
|
|
11
|
|
|
|
|
454
|
|
|
6
|
11
|
|
|
11
|
|
5447
|
use Poz::Types::string; |
|
|
11
|
|
|
|
|
39
|
|
|
|
11
|
|
|
|
|
577
|
|
|
7
|
11
|
|
|
11
|
|
5879
|
use Poz::Types::number; |
|
|
11
|
|
|
|
|
36
|
|
|
|
11
|
|
|
|
|
509
|
|
|
8
|
11
|
|
|
11
|
|
5317
|
use Poz::Types::object; |
|
|
11
|
|
|
|
|
42
|
|
|
|
11
|
|
|
|
|
458
|
|
|
9
|
11
|
|
|
11
|
|
5069
|
use Poz::Types::array; |
|
|
11
|
|
|
|
|
36
|
|
|
|
11
|
|
|
|
|
460
|
|
|
10
|
11
|
|
|
11
|
|
4970
|
use Poz::Types::enum; |
|
|
11
|
|
|
|
|
48
|
|
|
|
11
|
|
|
|
|
456
|
|
|
11
|
11
|
|
|
11
|
|
5212
|
use Poz::Types::union; |
|
|
11
|
|
|
|
|
37
|
|
|
|
11
|
|
|
|
|
426
|
|
|
12
|
11
|
|
|
11
|
|
5103
|
use Poz::Types::is; |
|
|
11
|
|
|
|
|
36
|
|
|
|
11
|
|
|
|
|
6122
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
|
15
|
169
|
|
|
169
|
1
|
348
|
my ($class) = @_; |
|
16
|
169
|
|
|
|
|
976
|
bless { |
|
17
|
|
|
|
|
|
|
need_coerce => 0, |
|
18
|
|
|
|
|
|
|
}, $class; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub coerce { |
|
22
|
2
|
|
|
2
|
0
|
6
|
my ($self) = @_; |
|
23
|
2
|
|
|
|
|
6
|
$self->{need_coerce} = 1; |
|
24
|
2
|
|
|
|
|
7
|
return $self; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub null { |
|
28
|
2
|
|
|
2
|
1
|
34
|
my ($self, $opts) = @_; |
|
29
|
2
|
|
50
|
|
|
13
|
$opts = $opts || {}; |
|
30
|
|
|
|
|
|
|
return Poz::Types::null->new({ |
|
31
|
2
|
|
|
|
|
21
|
%{$opts}, |
|
32
|
|
|
|
|
|
|
need_coerce => $self->{need_coerce}, |
|
33
|
2
|
|
|
|
|
6
|
}); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub string { |
|
37
|
81
|
|
|
81
|
1
|
162
|
my ($self, $opts) = @_; |
|
38
|
81
|
|
100
|
|
|
375
|
$opts = $opts || {}; |
|
39
|
|
|
|
|
|
|
return Poz::Types::string->new({ |
|
40
|
81
|
|
|
|
|
515
|
%{$opts}, |
|
41
|
|
|
|
|
|
|
need_coerce => $self->{need_coerce}, |
|
42
|
81
|
|
|
|
|
141
|
}); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub date { |
|
46
|
4
|
|
|
4
|
1
|
9
|
my ($self, $opts) = @_; |
|
47
|
4
|
|
50
|
|
|
14
|
$opts = $opts || {}; |
|
48
|
4
|
|
|
|
|
15
|
return $self->string({invalid_type_error => 'Not a date', %$opts})->date; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub datetime { |
|
52
|
1
|
|
|
1
|
0
|
2
|
my ($self, $opts) = @_; |
|
53
|
1
|
|
50
|
|
|
8
|
$opts = $opts || {}; |
|
54
|
1
|
|
|
|
|
3
|
return $self->string({invalid_type_error => 'Not a datetime', %$opts})->datetime; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub number { |
|
58
|
44
|
|
|
44
|
1
|
120
|
my ($self, $opts) = @_; |
|
59
|
44
|
|
100
|
|
|
188
|
$opts = $opts || {}; |
|
60
|
|
|
|
|
|
|
return Poz::Types::number->new({ |
|
61
|
44
|
|
|
|
|
262
|
%{$opts}, |
|
62
|
|
|
|
|
|
|
need_coerce => $self->{need_coerce}, |
|
63
|
44
|
|
|
|
|
82
|
}); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub object { |
|
67
|
13
|
|
|
13
|
1
|
25
|
my ($self, $opts) = @_; |
|
68
|
13
|
|
|
|
|
116
|
return Poz::Types::object->new({%$opts}); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub array { |
|
72
|
14
|
|
|
14
|
1
|
37
|
my ($self, $validator) = @_; |
|
73
|
14
|
|
|
|
|
73
|
return Poz::Types::array->new($validator); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub enum { |
|
77
|
3
|
|
|
3
|
1
|
9
|
my ($self, $opts) = @_; |
|
78
|
3
|
|
|
|
|
20
|
return Poz::Types::enum->new($opts); |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub union { |
|
82
|
6
|
|
|
6
|
1
|
19
|
my ($self, @validators) = @_; |
|
83
|
6
|
|
|
|
|
37
|
return Poz::Types::union->new(@validators); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub is { |
|
87
|
6
|
|
|
6
|
1
|
18
|
my ($self, $isa) = @_; |
|
88
|
6
|
|
|
|
|
38
|
return Poz::Types::is->new($isa); |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Poz::Builder - A module for building Poz projects |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
use Poz::Builder; |
|
100
|
|
|
|
|
|
|
my $builder = Poz::Builder->new(); |
|
101
|
|
|
|
|
|
|
$builder->build(); |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Poz::Builder is a module designed to facilitate the building and management of Poz projects. It provides methods to streamline the build process and ensure consistency across different environments. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 METHODS |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 new |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
my $builder = Poz::Builder->new(); |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Creates a new Poz::Builder object. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 build |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$builder->build(); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Executes the build process for the Poz project. |
|
120
|
|
|
|
|
|
|
=head2 coerce |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$builder->coerce(); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Enables coercion for the builder, which affects how types are handled. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 null |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
my $null_type = $builder->null(\%opts); |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Creates a new null type with the given options. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 string |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
my $string_type = $builder->string(\%opts); |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Creates a new string type with the given options. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 date |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $date_type = $builder->date(\%opts); |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Creates a new date type with the given options. This is a specialized string type. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 number |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
my $number_type = $builder->number(\%opts); |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Creates a new number type with the given options. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 object |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
my $object_type = $builder->object(\%opts); |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Creates a new object type with the given options. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 array |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
my $array_type = $builder->array($validator); |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Creates a new array type with the given validator. |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 enum |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
my $enum_type = $builder->enum(\%opts); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Creates a new enum type with the given options. |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 union |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $union_type = $builder->union(@validators); |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Creates a new union type with the given validators. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head2 is |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
my $is_type = $builder->is($isa); |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Creates a new is type with the given class. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 LICENSE |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Copyright (C) ytnobody. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
185
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 AUTHOR |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
ytnobody E<lt>ytnobody@gmail.comE<gt> |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |