line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Twitter::Role::WrapResult; |
2
|
|
|
|
|
|
|
$Net::Twitter::Role::WrapResult::VERSION = '4.01043'; |
3
|
1
|
|
|
1
|
|
526
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
4530
|
use Net::Twitter::WrappedResult; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
requires '_parse_result'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
around _parse_result => sub { |
9
|
|
|
|
|
|
|
my ( $next, $self ) = splice @_, 0, 2; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $http_response = $_[0]; |
12
|
|
|
|
|
|
|
my $result = $self->$next(@_); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return Net::Twitter::WrappedResult->new( |
15
|
|
|
|
|
|
|
result => $result, |
16
|
|
|
|
|
|
|
http_response => $http_response, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
no Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__END__ |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Net::Twitter::Role::WrapResult - Wrap Twitter API response and HTTP Response |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 4.01043 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 SYNOPSIS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Net::Twitter; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $nt = Net::Twitter->new( |
39
|
|
|
|
|
|
|
traits => [ qw/API::RESTv1_1 WrapResult/ ], |
40
|
|
|
|
|
|
|
%other_new_options, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $r = $nt->verify_credentials; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $http_response = $r->http_response; |
46
|
|
|
|
|
|
|
my $twitter_result = $r->result; |
47
|
|
|
|
|
|
|
my $rate_limit_remaining = $r->rate_limit_remaining; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Normally, Net::Twitter API methods return the decoded JSON body from the HTTP response. Some useful information, notably rate limit information, is included in HTTP response headers. With this role applied, API methods will return a L<Net::Twitter::WrappedResult> object that includes both the HTTP response and the decoded JSON response body. See L<Net::Twitter::WrappedResult> for details. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Marc Mims <marc@questright.com> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 COPYRIGHT |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Copyright (c) 2016 Marc Mims |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This library is free software and may be distributed under the same terms as perl itself. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|