WebService::TDWTF::Article - Class representing information about a TDWTF article
use WebService::TDWTF; my $article = tdwtf_article 8301; say $article->Id; # 8301 say $article->Slug; # your-recommended-virus say $article->SummaryHtml; say $article->BodyHtml; say $article->Body; say $article->Title; # Your Recommended Virus say $article->CoalescedCommentCount; say $article->DiscourseThreadUrl; # http://what.thedailywtf.com/t/your-recommended-virus/52541 say $article->PublishedDate; # 2015-11-12T06:30:00 say $article->DisplayDate; # 2015-11-12 say $article->Url; # http://thedailywtf.com/articles/your-recommended-virus say $article->CommentsUrl; # http://thedailywtf.com/articles/comments/your-recommended-virus say $article->PreviousArticleId; # 8299 say $article->PreviousArticleUrl; # //thedailywtf.com/articles/confession-rect-contains-point say $article->NextArticleId; # 8302 say $article->NextArticleUrl; # //thedailywtf.com/articles/who-stole-the-search-box say $article->AuthorName; # Ellis Morning say $article->AuthorShortDescription; # Editor say $article->AuthorDescriptionHtml; say $article->AuthorSlug; # ellis-morning say $article->AuthorImageUrl; # http://img.thedailywtf.com/images/remy/ellis01.jpg say $article->SeriesSlug; # feature-articles say $article->SeriesTitle; # Feature Articles say $article->SeriesDescription; say $article->PreviousArticle->Title # Confession: rect.Contains(point) say $article->NextArticle->Title # Who Stole the Search Box?!
A WebService::TDWTF::Article object represents an article on http://thedailywtf.com. Objects of this class are returned by the functions in WebService::TDWTF. Each such object is guaranteed to be a blessed hashref corresponding to the JSON returned by the TDWTF API (possibly with some extra keys), so the data inside can be obtained by simply dereferencing the object.
The ArticleModel class in the TDWTF source code might be helpful in finding the available attributes and understanding their meaning. It can be found here: https://github.com/tdwtf/WtfWebApp/blob/master/TheDailyWtf/Models/ArticleModel.cs
Several accessors and convenience functions are provided for accessing the most common attributes. See the SYNOPSIS for usage examples.
The numerical ID of the article.
The string ID of the article.
The title of the article
URL of the article itself.
The summary (first 1-2 paragraphs) of the article.
The body of the article. If the object comes from a tdwtf_list_* function, this method returns "".
The body of the article. If the object comes from a tdwtf_list_* function, this method retreives the body from the server, saves it in the object and returns it.
The advertisment in the footer of the article. If the object comes from a list_ function, this method returns "".
The number of comments of the article.
URL to the featured comments list. See DiscourseThreadUrl for the URL to the full comment thread.
URL of the full comment thread on what.thedailywtf.com.
Date and time when the article was published in ISO 8601 format, with no timezone.
Date when the article was published in ISO 8601 format, with no timezone.
Name of the article's author.
A one-line description of the article's author.
A longer description of the article's author.
The ID of the article's author, suitable for passing to the tdwtf_list_author function of WebService::TDWTF.
URL to an image of the article's author.
The ID of the article's series, suitable for passing to the tdwtf_list_series function of WebService::TDWTF
The name of the article's series.
A description of the article's series.
The numerical ID of the previous article.
URL of the previous article.
Retrieves the previous article using WebService::TDWTF and returns it as a WebService::TDWTF::Article object.
The numerical ID of the next article.
URL of the next article.
Retrieves the next article using WebService::TDWTF and returns it as a WebService::TDWTF::Article object.
Marius Gavrilescu, <marius@ieval.ro>
Copyright (C) 2016 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.2 or, at your option, any later version of Perl 5 you may have available.
To install WebService::TDWTF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::TDWTF
CPAN shell
perl -MCPAN -e shell install WebService::TDWTF
For more information on module installation, please visit the detailed CPAN module installation guide.