| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Web::NewsAPI::Source; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20
|
use v5.10; |
|
|
1
|
|
|
|
|
4
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4975
|
use Web::NewsAPI::Types; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
155
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'id' => ( |
|
9
|
|
|
|
|
|
|
required => 1, |
|
10
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'name' => ( |
|
15
|
|
|
|
|
|
|
required => 1, |
|
16
|
|
|
|
|
|
|
isa => 'Str', |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'description' => ( |
|
21
|
|
|
|
|
|
|
isa => 'Str', |
|
22
|
|
|
|
|
|
|
is => 'ro', |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has 'category' => ( |
|
26
|
|
|
|
|
|
|
isa => 'Str', |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'language' => ( |
|
31
|
|
|
|
|
|
|
isa => 'Str', |
|
32
|
|
|
|
|
|
|
is => 'ro', |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has 'country' => ( |
|
36
|
|
|
|
|
|
|
isa => 'Str', |
|
37
|
|
|
|
|
|
|
is => 'ro', |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has 'url' => ( |
|
41
|
|
|
|
|
|
|
coerce => 1, |
|
42
|
|
|
|
|
|
|
isa => 'NewsURI', |
|
43
|
|
|
|
|
|
|
is => 'ro', |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Web::NewsAPI::Source - Object class representing a News API source |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use v5.10; |
|
55
|
|
|
|
|
|
|
use Web::NewsAPI; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $newsapi = Web::NewsAPI->new( |
|
58
|
|
|
|
|
|
|
api_key => $my_secret_api_key, |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
say "Here are some sources for English-language science news..."; |
|
62
|
|
|
|
|
|
|
my @sources = $newsapi->sources( |
|
63
|
|
|
|
|
|
|
category => 'science', |
|
64
|
|
|
|
|
|
|
language => 'en' |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
for my $source ( @sources ) { |
|
67
|
|
|
|
|
|
|
say $source->name; |
|
68
|
|
|
|
|
|
|
if ( defined $source->id ) { |
|
69
|
|
|
|
|
|
|
say "...it has the NewsAPI ID " . $source->id; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
|
|
|
|
|
|
say "...but it doesn't have a NewsAPI ID."; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Objects of this class represent a News API news source. Generally, you |
|
79
|
|
|
|
|
|
|
won't create these objects yourself; you'll get them as a result of |
|
80
|
|
|
|
|
|
|
calling L<sources() on a Web::NewsAPI object|Web::NewsAPI/"sources">. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 METHODS |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 Object attributes |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
These are all read-only attributes, based on information provided by |
|
87
|
|
|
|
|
|
|
News API. They are all strings, except for C<url>, which is a L<URI> |
|
88
|
|
|
|
|
|
|
object. Any of them might be undefined, except for C<name>. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
id |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
name |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
description |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
url |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
category |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
language |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
country |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Jason McIntosh (jmac@jmac.org) |