perldoc > Net::Twitter::Role::InflateObjects

📛 NAME

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

🚀 Quick Reference

Use CaseCommandDescription
Create a Twitter client with object inflationmy $nt = Net::Twitter->new(traits => [qw/InflateObjects API::Rest/]);🔧 Load the InflateObjects trait to inflate API responses into Moose objects
Access user name from timeline$r->[0]->user->name🏷️ Use object accessors instead of hash dereferencing
Get relative time string$r->[0]->relative_created_at⏳ Returns "6 minutes ago" style string
Access nested attributes$r->[0]->user->screen_name🔗 Inflated objects provide read accessors for all hash keys

📚 VERSION

version 4.01043

📝 SYNOPSIS

use Net::Twitter;
my $nt = Net::Twitter->new(traits => [qw/InflateObjects API::Rest/]);

$nt->credentials($username, $password);

$r = $nt->friends_timeline;

$r->[0]->user->name; # return values are objects with read accessors
$r->[0]->created_at; # dates are inflated to DateTime objects
$r->[0]->relative_created_at; # "6 minutes ago"

📖 DESCRIPTION

This role provides inflation of HASH refs, returned by the Twitter API, into Moose objects. URLs are inflated to URI objects. Dates are inflated to DateTime objects. Objects that have a "created_at" attribute also have a "relative_created_at" method that prints times in the same style as the Twitter web interface.

All HASH members have read accessors, so

$r->[0]->{user}{screen_name}

Can be accessed as

$r->[0]->user->screen_name

⚠️ CAVEATS

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

✍️ AUTHOR

Marc Mims <marc AT questright.com>

📜 LICENSE

Copyright (c) 2016 Marc Mims

The Twitter API itself, and the description text used in this module is:

Copyright (c) 2009 Twitter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Net::Twitter::Role::InflateObjects
📛 NAME 🚀 Quick Reference 📚 VERSION 📝 SYNOPSIS 📖 DESCRIPTION ⚠️ CAVEATS ✍️ AUTHOR 📜 LICENSE

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 08:08 @216.73.216.194
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format