The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Web::NewsAPI::Artcle - Object class representing a News API article

SYNOPSIS

 use v5.10;
 use Web::NewsAPI;

 my $newsapi = Web::NewsAPI->new(
    api_key => $my_secret_api_key,
 );

 say "Here are some top American-news headlines about science...";
 my @articles = $newsapi->top_headlines(
    category => 'science', country => 'us',
 );
 for my $article ( @articles ) {
    say $article->title;
    say $article->description;
    print "\n";
 }

DESCRIPTION

Objects of this class represent a News API news article. Generally, you won't create these objects yourself; you'll get them as a result of calling methods on a Web::NewsAPI object.

METHODS

Object attributes

These are all read-only attributes, based on information provided by News API. (They use camelCase because they just copy the attribute names from News API itself.)

source

A Web::NewsAPI::Source object.

author

A string.

title

A string.

description

A string.

url

A URI object. (Possibly undefined.)

urlToImage

A URI object. (Possibly undefined.)

publishedAt

A DateTime object.

AUTHOR

Jason McIntosh (jmac@jmac.org)