Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-Twitter CPAN distribution.

Report information
The Basics
Id: 54901
Status: resolved
Priority: 0/
Queue: Net-Twitter

People
Owner: Nobody in particular
Requestors: va3sie [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 3.11004
Fixed in: (no value)



I noticed that using synthetic argument since did not work when Net::Twitter is constructed with InflateObjects trait as follows: my $nt = Net::Twitter->new( traits => ['API::REST', 'OAuth', 'RateLimit', 'InflateObjects'], consumer_key => "...", consumer_secret => "...", ssl => 1 ) or croak "$0: Failed to create twitter API object."; then: my $statuses = $twitter->user_timeline({ id => '...', since => DateTime->now }); This was returning 20 statuses, it should have returned 0. The problem lies in this function: Net::Twitter::Core::_contains_statuses This line: return unless ref $e eq 'HASH'; does not work when the 'InflateObjects' trait is in effect. In this case, ref $e eq 'Class::MOP::Class::__ANON__::SERIAL::4'. I changed it instead to: return unless ref $e eq 'HASH' || reftype $e eq 'HASH'; That worked. It could possibly be simplified further to: return unless reftype $e eq 'HASH'; But I did not try that.
Subject: "since" sythetic argument with InflateObjects role
On Mon Feb 22 23:03:49 2010, mgillen wrote: Show quoted text
> I noticed that using synthetic argument since did not work when > Net::Twitter is constructed with InflateObjects trait as follows: > > my $nt = Net::Twitter->new( > traits => ['API::REST', 'OAuth', 'RateLimit', > 'InflateObjects'], > consumer_key => "...", > consumer_secret => "...", > ssl => 1 > ) or croak "$0: Failed to create twitter API object."; > > then: > > my $statuses = $twitter->user_timeline({ > id => '...', > since => DateTime->now }); > > This was returning 20 statuses, it should have returned 0. > > The problem lies in this function: > > Net::Twitter::Core::_contains_statuses > > This line: > > return unless ref $e eq 'HASH'; > > does not work when the 'InflateObjects' trait is in effect. > > In this case, ref $e eq 'Class::MOP::Class::__ANON__::SERIAL::4'. > > I changed it instead to: > > return unless ref $e eq 'HASH' || reftype $e eq 'HASH'; > > That worked. > > It could possibly be simplified further to: > > return unless reftype $e eq 'HASH'; > > But I did not try that.
Thanks for the report, and especially for tracking it down to the errant line of code. I've fixed the code in the repository trunk and will release a new version including it soon. reftype can return undef, so the fix I applied was: return unless ref $e && reftype $e eq 'HASH'; -Marc