Twitte...::Util(3pm)
π Twitter::API::Util β bestie edition π
okay so real talk: this is Twitter::API::Util, a lil Perl module from the Twitter::API fam (that's the 3pm manual-page crew, perl documentation section 3, user-contributed). It's the utility drawer of the group chat β all the little helper functions you keep needing when you're out here wrestling with the Twitter API. π¦β¨
VERSION: this is version 1.0006, periodt.
πΈ SYNOPSIS πΈ
okay bestie here's the whole vibe in one block, copy it, love it, use it:
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;
}
likeβ¦ look at that. timestamps converted, errors checked, whole thing ate. π
π¦ DESCRIPTION π¦
it exports helpful utility functions. that's it, that's the description, no notes. π
β¨ METHODS β¨
π timestamp_to_gmtime
hands you back gmtime made from a Twitter timestamp string. for the full tea, go peek at "gmtime-EXPR" in perlfunc. β
π timestamp_to_localtime
hands you back localtime for a Twitter timestamp string. the whole story lives at "localtime-EXPR" in perlfunc. π
π timestamp_to_time
hands you back a UNIX epoch time for a Twitter timestamp string. details are at "time" in perlfunc. β³
π is_twitter_api_error
returns true if the scalar you passed in is a Twitter::API::Error. otherwise it returns false. that's the whole function, she's simple and she's iconic. π
π AUTHOR π
Marc Mims <marc@questright.com> β shoutout to the icon who built this π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015-2021 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
ngl that's the good kind of license, free software, same terms as Perl 5 itself, no cap π
and that's a wrap bestie π this page came to you courtesy of perl v5.32.1, dated 2021-09-11, from the Twitter::API::Util manual (section 3pm, user contributed Perl documentation). go forth and convert those timestamps, main character π
β¨
π¦ where this page comes from
- debian bookworm: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms