Twitter::API::Trait::DecodeHtmlEntities(3pm)

Twitter::API::Trait::DecodeHtmlEntities3pm

Decode html entities in strings

Usage

    use Twitter::API;
    use open qw/:std :utf8/;
    my $client = Twitter::API->new_with_traits(
        traits => [ qw/ApiMethods DecodeHtmlEntites/ ],
        %other_options
    );
    my $status = $client->show_status(801814387723935744);
    say $status->{text};
    # output:
    # Test DecodeHtmlEntities trait. < & > XX X 'single' "double"
    #
    # output without the DecodeHtmlEntities trait:
    # Test DecodeHtmlEntities trait. &lt; &amp; &gt; XX X 'single' "double"

Version

version 1.0006

Overview

Twitter has trust issues. They assume you're going to push the text you receive in API responses to a web page without HTML encoding it. But you HTML encode all of your output right? And Twitter's lack of trust has you double encoding entities.

So, include this trait and Twitter::API will decode HTML entities in all of the text returned by the API.

You're welcome.

Releases

4 releases since Debian 10 (Buster); the text changed 1 time.

  1. 10–11
  2. 12–13

Author

Marc Mims <[email protected]>

From libtwitter-api-perl 1.0006-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.