Net::T...dResult(3pm)
π NAME π
Net::Twitter::WrappedResult β bestie, it wraps an HTTP response and a Twitter result together, like a little friendship bracelet where both halves stay attached π«Ά
(also it's a User Contributed Perl Documentation page, and it's filed under the manual name Net::T...dResult(3pm) because apparently whoever named the file got distracted mid-word π)
β¨ VERSION β¨
version 4.01043 β yes queen, we're on the 4.x era πΈ
π SYNOPSIS π
okay so here's the whole vibe, verbatim, no notes:
use Net::Twitter;
my $nt = Net::Twitter->new(
traits => [ qw/API::RESTv1_1 WrapResult/ ],
%other_new_options,
);
my $r = $nt->verify_credentials;
my $http_response = $r->http_response;
my $twitter_result = $r->result;
my $rate_limit_remaining = $r->rate_limit_remaining;
see how WrapResult is right there in the traits list? that's the moment it all comes together, it's giving main character energy π
π DESCRIPTION π
so here's the tea, bestie π
a lot of the time, the result you get back from a Twitter API call β the one that gets inflated from the JSON body of the HTTP response β does not have everything you need. not even close. because Twitter likes to stash extra meta data, stuff like rate limiting info, over in the HTTP response headers, not in the body. sneaky. iconic, but sneaky.
this object wraps both of them: the inflated Twitter result and the HTTP response. so the caller gets full access to all that meta data, no cap. and bonus: it also hands you accessors for the rate limit info, so you don't have to go digging through headers yourself like some kind of raccoon π¦
π METHODS π
new(result => $twitter_result, http_response => $http_response)
constructs the object, wrapping up the Twitter result and the HTTP response together. that's it, that's the job π
result
returns the Twitter API result β aka the decoded JSON response body. the actual content, the moment, the whole point π
http_response
returns the HTTP::Response object for the API call. this is where all the meta data lives, bestie, don't sleep on it β
rate_limit
returns the rate limit, per 15 minute window, for the API endpoint that was called. if there's no suitable rate limit header available, it returns undef. no header, no number, no drama π
rate_limit_remaining
returns the calls remaining in the current 15 minute window for the API endpoint that was called. and same deal: returns undef if no suitable header is available π
rate_limit_reset
returns the Unix epoch time of the next 15 minute window for the API endpoint that was called β like, the moment the rate limit resets and you're free again. returns undef if no suitable header is available π§
quick vibe check: three of these bad boys can just hand you undef when the header isn't there. always check before you do math on them, fr fr π
π AUTHOR π
Marc Mims <marc@questright.com> β the legend, the icon π
πΈ COPYRIGHT & LICENSE πΈ
Copyright (c) 2016 Marc Mims
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.
and that's the whole page, bestie!! this was Net::T...dResult(3pm) from the User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-06-16 πβ¨ go forth and check your rate limits responsibly, ily π
π
π¦ where this page comes from
- debian bookworm: libnet-twitter-perl 4.01043-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-twitter-perl 4.01043-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-twitter-perl 4.01043-2 Β· 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