NAME
Web::NewsAPI::Source - Object class representing a News API source
SYNOPSIS
use v5.10;
use Web::NewsAPI;
my $newsapi = Web::NewsAPI->new(
api_key => $my_secret_api_key,
);
say "Here are some sources for English-language science news...";
my @sources = $newsapi->sources(
category => 'science',
language => 'en'
);
for my $source ( @sources ) {
say $source->name;
if ( defined $source->id ) {
say "...it has the NewsAPI ID " . $source->id;
}
else {
say "...but it doesn't have a NewsAPI ID.";
}
}
DESCRIPTION
Objects of this class represent a News API news source. Generally, you won't create these objects yourself; you'll get them as a result of calling sources() on a Web::NewsAPI object.
METHODS
Object attributes
These are all read-only attributes, based on information provided by News API. They are all strings, except for url
, which is a URI object. Any of them might be undefined, except for name
.
id
name
description
url
category
language
country
AUTHOR
Jason McIntosh (jmac@jmac.org)