line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::MinFraud::Data::Rx::Type::Enum; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
42
|
use 5.010; |
|
2
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
37
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
43
|
|
7
|
2
|
|
|
2
|
|
9
|
use namespace::autoclean; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '1.009001'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
184
|
use parent 'Data::Rx::CommonType::EasyNew'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub assert_valid { |
14
|
14
|
|
|
14
|
0
|
1807
|
my ( $self, $value ) = @_; |
15
|
|
|
|
|
|
|
|
16
|
14
|
|
|
|
|
61
|
$self->{schema}->assert_valid($value); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub guts_from_arg { |
20
|
135
|
|
|
135
|
0
|
323629
|
my ( undef, $arg, $rx ) = @_; |
21
|
|
|
|
|
|
|
|
22
|
135
|
|
|
|
|
936
|
my $meta = $rx->make_schema( |
23
|
|
|
|
|
|
|
{ |
24
|
|
|
|
|
|
|
type => '//rec', |
25
|
|
|
|
|
|
|
required => { |
26
|
|
|
|
|
|
|
contents => { |
27
|
|
|
|
|
|
|
type => '//rec', |
28
|
|
|
|
|
|
|
required => { |
29
|
|
|
|
|
|
|
type => '//str', # e.g. //int or //str. Really we only |
30
|
|
|
|
|
|
|
# want schemas that have a 'value' option |
31
|
|
|
|
|
|
|
values => { |
32
|
|
|
|
|
|
|
type => '//arr', |
33
|
|
|
|
|
|
|
contents => '//def', |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# should be of type, as above, but we can't test this, |
36
|
|
|
|
|
|
|
# so we accept any defined value for now, and then test |
37
|
|
|
|
|
|
|
# the values below |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
135
|
|
|
|
|
41116
|
$meta->assert_valid($arg); |
46
|
|
|
|
|
|
|
|
47
|
135
|
|
|
|
|
85320
|
my $type = $arg->{contents}{type}; |
48
|
135
|
|
|
|
|
241
|
my @values = @{ $arg->{contents}{values} }; |
|
135
|
|
|
|
|
785
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# subsequent test that the provided values are acceptable |
51
|
135
|
|
|
|
|
613
|
$rx->make_schema( { type => '//arr', contents => $type } ) |
52
|
|
|
|
|
|
|
->assert_valid( \@values ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $schema = $rx->make_schema( |
55
|
|
|
|
|
|
|
{ |
56
|
|
|
|
|
|
|
type => '//any', |
57
|
135
|
|
|
|
|
99049
|
of => [ map { { type => $type, value => $_ } } @values, ] |
|
5060
|
|
|
|
|
10077
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
135
|
|
|
|
|
304783
|
return { schema => $schema, }; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub type_uri { |
65
|
|
|
|
|
|
|
## no critic(ValuesAndExpressions::ProhibitCommaSeparatedStatements) |
66
|
55
|
|
|
55
|
0
|
15551
|
'tag:maxmind.com,MAXMIND:rx/enum'; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# ABSTRACT: A type that defines an enumeration |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=encoding UTF-8 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
WebService::MinFraud::Data::Rx::Type::Enum - A type that defines an enumeration |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 VERSION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
version 1.009001 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SUPPORT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Bugs may be submitted through L<https://github.com/maxmind/minfraud-api-perl/issues>. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Mateu Hunter <mhunter@maxmind.com> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is copyright (c) 2015 - 2019 by MaxMind, Inc. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
100
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=cut |