line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphQL::Type::NonNull; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
472
|
use 5.014; |
|
18
|
|
|
|
|
68
|
|
4
|
18
|
|
|
18
|
|
99
|
use strict; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
399
|
|
5
|
18
|
|
|
18
|
|
86
|
use warnings; |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
444
|
|
6
|
18
|
|
|
18
|
|
92
|
use Moo; |
|
18
|
|
|
|
|
32
|
|
|
18
|
|
|
|
|
134
|
|
7
|
18
|
|
|
18
|
|
6738
|
use Types::Standard -all; |
|
18
|
|
|
|
|
58
|
|
|
18
|
|
|
|
|
157
|
|
8
|
18
|
|
|
18
|
|
796517
|
use GraphQL::MaybeTypeCheck; |
|
18
|
|
|
|
|
53
|
|
|
18
|
|
|
|
|
230
|
|
9
|
|
|
|
|
|
|
extends qw(GraphQL::Type); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# A-ha |
14
|
|
|
|
|
|
|
my @TAKE_ON_ME = qw( |
15
|
|
|
|
|
|
|
GraphQL::Role::Input |
16
|
|
|
|
|
|
|
GraphQL::Role::Output |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
GraphQL::Type::NonNull - GraphQL type that is a non-null version of another type |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use GraphQL::Type::NonNull; |
26
|
|
|
|
|
|
|
my $type = GraphQL::Type::NonNull->new(of => $other_type); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Type that is a wrapper for another type. Means data cannot be a null value. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 of |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
GraphQL type object of which this is a non-null version. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has of => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => InstanceOf['GraphQL::Type'], |
43
|
|
|
|
|
|
|
required => 1, |
44
|
|
|
|
|
|
|
handles => [ qw(name) ], |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 BUILD |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
L<Moo> method that applies the relevant roles. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub BUILD { |
56
|
242
|
|
|
242
|
1
|
59733
|
my ($self, $args) = @_; |
57
|
242
|
|
|
|
|
629
|
my $of = $self->of; |
58
|
242
|
|
|
|
|
1046
|
Role::Tiny->apply_roles_to_object($self, grep $of->DOES($_), @TAKE_ON_ME); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 to_string |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Part of serialisation. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has to_string => (is => 'lazy', isa => Str, init_arg => undef, builder => sub { |
68
|
12
|
|
|
12
|
|
521
|
my ($self) = @_; |
69
|
12
|
|
|
|
|
236
|
$self->of->to_string . '!'; |
70
|
|
|
|
|
|
|
}); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 is_valid |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
True if given Perl value is a valid value for this type. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
1
|
50
|
|
1
|
1
|
713
|
method is_valid(Any $item) :ReturnType(Bool) { |
|
1
|
50
|
|
|
|
4
|
|
|
1
|
50
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
61
|
|
79
|
1
|
50
|
33
|
|
|
18
|
return if !defined $item or !$self->of->is_valid($item); |
80
|
1
|
|
|
|
|
40
|
1; |
81
|
18
|
|
|
18
|
|
3243
|
} |
|
18
|
|
|
|
|
44
|
|
|
18
|
|
|
|
|
152
|
|
82
|
|
|
|
|
|
|
|
83
|
75
|
50
|
|
75
|
1
|
232
|
method graphql_to_perl(Any $item) :ReturnType(Any) { |
|
75
|
50
|
|
|
|
203
|
|
|
75
|
50
|
|
|
|
131
|
|
|
75
|
|
|
|
|
166
|
|
|
75
|
|
|
|
|
205
|
|
|
75
|
|
|
|
|
486
|
|
84
|
75
|
|
|
|
|
239
|
my $of = $self->of; |
85
|
75
|
|
100
|
|
|
326
|
$of->graphql_to_perl($item) // die $self->to_string . " given null value.\n"; |
86
|
18
|
|
|
18
|
|
9725
|
} |
|
18
|
|
|
|
|
52
|
|
|
18
|
|
|
|
|
101
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 name |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The C<name> of the type this object is a non-null version of. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |