1Net::Twitter::Role::InfUlsaetreOCbojnetcrtisb(u3t)ed PerNletD:o:cTuwmietntteart:i:oRnole::InflateObjects(3)
2
3
4

NAME

6       Net::Twitter::Role::InflateObjects - Inflate Twitter API return values
7       to Moose objects
8

VERSION

10       version 4.01043
11

SYNOPSIS

13         use Net::Twitter;
14         my $nt = Net::Twitter->new(traits => [qw/InflateObjects API::Rest/]);
15
16         $nt->credentials($username, $password);
17
18         $r = $nt->friends_timeline;
19
20         $r->[0]->user->name; # return values are objects with read accessors
21         $r->[0]->created_at; # dates are inflated to DateTime objects
22         $r->[0]->relative_created_at; # "6 minutes ago"
23

DESCRIPTION

25       This role provides inflation of HASH refs, returned by the Twitter API,
26       into Moose objects.  URLs are inflated to URI objects.  Dates are
27       inflated to DateTime objects.  Objects that have a "created_at"
28       attribute also have a "relative_created_at" method that prints times in
29       the same style as the Twitter web interface.
30
31       All HASH members have read accessors, so
32
33         $r->[0]->{user}{screen_name}
34
35       Can be accessed as
36
37         $r->[0]->user->screen_name
38

CAVEATS

40       An accessor is created for each HASH key returned by Twitter.  As
41       Twitter adds new attributes, InflateObjects will create accessors for
42       them.  However,
43           InflateObjects will also drop accessors if Twitter drops the
44       corresponding HASH element.  So, code that relies on HASH element will
45       fail loudly if Twitter drops support for it.  (This may be a feature!)
46

AUTHOR

48       Marc Mims <marc@questright.com>
49

LICENSE

51       Copyright (c) 2016 Marc Mims
52
53       The Twitter API itself, and the description text used in this module
54       is:
55
56       Copyright (c) 2009 Twitter
57
58       This library is free software; you can redistribute it and/or modify it
59       under the same terms as Perl itself.
60
61
62
63perl v5.32.1                      2021-01-N2e7t::Twitter::Role::InflateObjects(3)
Impressum