line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphQL::Type::NonNull; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
394
|
use 5.014; |
|
18
|
|
|
|
|
67
|
|
4
|
18
|
|
|
18
|
|
97
|
use strict; |
|
18
|
|
|
|
|
43
|
|
|
18
|
|
|
|
|
374
|
|
5
|
18
|
|
|
18
|
|
94
|
use warnings; |
|
18
|
|
|
|
|
38
|
|
|
18
|
|
|
|
|
456
|
|
6
|
18
|
|
|
18
|
|
92
|
use Moo; |
|
18
|
|
|
|
|
43
|
|
|
18
|
|
|
|
|
116
|
|
7
|
18
|
|
|
18
|
|
6530
|
use Types::Standard -all; |
|
18
|
|
|
|
|
54
|
|
|
18
|
|
|
|
|
147
|
|
8
|
18
|
|
|
18
|
|
839107
|
use GraphQL::MaybeTypeCheck; |
|
18
|
|
|
|
|
49
|
|
|
18
|
|
|
|
|
152
|
|
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
|
57751
|
my ($self, $args) = @_; |
57
|
242
|
|
|
|
|
647
|
my $of = $self->of; |
58
|
242
|
|
|
|
|
990
|
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
|
|
546
|
my ($self) = @_; |
69
|
12
|
|
|
|
|
285
|
$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
|
1201
|
method is_valid(Any $item) :ReturnType(Bool) { |
|
1
|
50
|
|
|
|
5
|
|
|
1
|
50
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
70
|
|
79
|
1
|
50
|
33
|
|
|
18
|
return if !defined $item or !$self->of->is_valid($item); |
80
|
1
|
|
|
|
|
24
|
1; |
81
|
18
|
|
|
18
|
|
3269
|
} |
|
18
|
|
|
|
|
69
|
|
|
18
|
|
|
|
|
141
|
|
82
|
|
|
|
|
|
|
|
83
|
75
|
50
|
|
75
|
1
|
304
|
method graphql_to_perl(Any $item) :ReturnType(Any) { |
|
75
|
50
|
|
|
|
227
|
|
|
75
|
50
|
|
|
|
158
|
|
|
75
|
|
|
|
|
171
|
|
|
75
|
|
|
|
|
238
|
|
|
75
|
|
|
|
|
559
|
|
84
|
75
|
|
|
|
|
275
|
my $of = $self->of; |
85
|
75
|
|
100
|
|
|
320
|
$of->graphql_to_perl($item) // die $self->to_string . " given null value.\n"; |
86
|
18
|
|
|
18
|
|
9724
|
} |
|
18
|
|
|
|
|
43
|
|
|
18
|
|
|
|
|
77
|
|
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; |