line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Feed::Types { |
2
|
4
|
|
|
4
|
|
468361
|
use Type::Library -base; |
|
4
|
|
|
|
|
94807
|
|
|
4
|
|
|
|
|
43
|
|
3
|
4
|
|
|
4
|
|
3382
|
use Type::Utils -all; |
|
4
|
|
|
|
|
20119
|
|
|
4
|
|
|
|
|
38
|
|
4
|
4
|
|
|
4
|
|
15962
|
use Types::Standard qw; |
|
4
|
|
|
|
|
205446
|
|
|
4
|
|
|
|
|
51
|
|
5
|
4
|
|
|
4
|
|
8350
|
use Types::Common::Numeric qw< PositiveOrZeroInt >; |
|
4
|
|
|
|
|
51388
|
|
|
4
|
|
|
|
|
54
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $AuthorWithoutExt = declare JSONFeedAuthorWithoutExt => as Dict[ |
8
|
|
|
|
|
|
|
name => Optional[Str], |
9
|
|
|
|
|
|
|
url => Optional[Str], |
10
|
|
|
|
|
|
|
avatar => Optional[Str], |
11
|
|
|
|
|
|
|
], where { |
12
|
|
|
|
|
|
|
exists($_->{name}) || exists($_->{url}) || exists($_->{avatar}) |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $Author = declare JSONFeedAuthor => as HashRef, where { |
16
|
|
|
|
|
|
|
my $val = $_; |
17
|
|
|
|
|
|
|
my %o = map { $_ => $val->{$_} } grep { ! /^_/ } keys %$val; |
18
|
|
|
|
|
|
|
$AuthorWithoutExt->check(\%o); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $AttachmentWithoutExt = declare JSONFeedAttachmentWithoutExt => as Dict[ |
22
|
|
|
|
|
|
|
url => Str, |
23
|
|
|
|
|
|
|
mime_type => Str, |
24
|
|
|
|
|
|
|
title => Optional[Str], |
25
|
|
|
|
|
|
|
size_in_bytes => Optional[PositiveOrZeroInt], |
26
|
|
|
|
|
|
|
duration_in_seconds => Optional[PositiveOrZeroInt], |
27
|
|
|
|
|
|
|
]; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $Attachment = declare JSONFeedAttachment => as HashRef, where { |
30
|
|
|
|
|
|
|
my $val = $_; |
31
|
|
|
|
|
|
|
my %o = map { $_ => $val->{$_} } grep { ! /^_/ } keys %$val; |
32
|
|
|
|
|
|
|
$AttachmentWithoutExt->check(\%o); |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $ItemWithoutExt = declare JSONFeedItemWithoutExt => as Dict[ |
36
|
|
|
|
|
|
|
id => Str, |
37
|
|
|
|
|
|
|
url => Optional[Str], |
38
|
|
|
|
|
|
|
external_url => Optional[Str], |
39
|
|
|
|
|
|
|
title => Optional[Str], |
40
|
|
|
|
|
|
|
content_html => Optional[Str], |
41
|
|
|
|
|
|
|
content_text => Optional[Str], |
42
|
|
|
|
|
|
|
summary => Optional[Str], |
43
|
|
|
|
|
|
|
image => Optional[Str], |
44
|
|
|
|
|
|
|
banner_image => Optional[Str], |
45
|
|
|
|
|
|
|
date_published => Optional[Str], |
46
|
|
|
|
|
|
|
date_modified => Optional[Str], |
47
|
|
|
|
|
|
|
author => Optional[ $Author ], |
48
|
|
|
|
|
|
|
tags => Optional[ArrayRef[Str]], |
49
|
|
|
|
|
|
|
attachments => Optional[ArrayRef[ $Attachment ]], |
50
|
|
|
|
|
|
|
]; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $Item = declare JSONFeedItem => as HashRef, where { |
53
|
|
|
|
|
|
|
my $val = $_; |
54
|
|
|
|
|
|
|
my %o = map { $_ => $val->{$_} } grep { ! /^_/ } keys %$val; |
55
|
|
|
|
|
|
|
$ItemWithoutExt->check(\%o); |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $JSONFeedWithoutExt = declare JSONFeedWithoutExt => as Dict[ |
59
|
|
|
|
|
|
|
version => Str, |
60
|
|
|
|
|
|
|
title => Str, |
61
|
|
|
|
|
|
|
description => Optional[Str], |
62
|
|
|
|
|
|
|
user_comment => Optional[Str], |
63
|
|
|
|
|
|
|
next_url => Optional[Str], |
64
|
|
|
|
|
|
|
icon => Optional[Str], |
65
|
|
|
|
|
|
|
favicon => Optional[Str], |
66
|
|
|
|
|
|
|
author => Optional[ $Author ], |
67
|
|
|
|
|
|
|
home_page_url => Optional[Str], |
68
|
|
|
|
|
|
|
feed_url => Optional[Str], |
69
|
|
|
|
|
|
|
expired => Optional[Bool], |
70
|
|
|
|
|
|
|
hub => Optional[ArrayRef], |
71
|
|
|
|
|
|
|
items => ArrayRef[ $Item ], |
72
|
|
|
|
|
|
|
]; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
declare JSONFeed => as HashRef, where { |
75
|
|
|
|
|
|
|
my $val = $_; |
76
|
|
|
|
|
|
|
my %o = map { $_ => $val->{$_} } grep { ! /^_/ } keys %$val; |
77
|
|
|
|
|
|
|
$JSONFeedWithoutExt->check(\%o); |
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
81
|
|
|
|
|
|
|
}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
JSON::Feed::Types - The Types for JSON::Feed package. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use JSON::Feed::Types; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
JSONFeedAuthor->assert_validate( $obj1 ); |
94
|
|
|
|
|
|
|
JSONFeedAttachment->assert_validate( $obj2 ); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
In this Type library, the following 4 types are defined and exported. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=over 4 |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item JSONFeed |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item JSONFeedItem |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item JSONFeedAuthor |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item JSONFeedAttachment |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
These Types are object defined with L and therefore |
113
|
|
|
|
|
|
|
have methods listed here: L. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Each type corresponds to an object defined in L. |