Twitter::API::Util(3pm)

Twitter::API::Util3pm

Utilities for working with the twitter api

Usage

    use Twitter::API::Util ':all';
    # Given a timestamp in Twitter's text format:
    my $ts = $status->{created_at}; # "Wed Jun 06 20:07:10 +0000 2012"
    # Convert it UNIX epoch seconds (a Perl "time" value):
    my $time = timestamp_to_time($status->{created_at});
    # Or a Perl localtime:
    my $utc = timestamp_to_timepiece($status->{created_at});
    # Or a Perl gmtime:
    my $utc = timestamp_to_gmtime($status->{created_at});
    # Check to see if an exception is a Twitter::API::Error
    if ( is_twitter_api_error($@) ) {
        warn "Twitter API error: " . $@->twitter_error_text;
    }

Version

version 1.0006

Overview

Exports helpful utility functions.

Methods

timestamp_to_gmtime

Returns "gmtime" from a Twitter timestamp string. See "gmtime-EXPR" in perlfunc for details.

timestamp_to_localtime

Returns "localtime" for a Twitter timestamp string. See "localtime-EXPR" in perlfunc for details.

timestamp_to_time

Returns a UNIX epoch time for a Twitter timestamp string. See "time" in perlfunc for details.

is_twitter_api_error

Returns true if the scalar passed to it is a Twitter::API::Error. Otherwise, it returns false.

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.