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: 41762
Status: resolved
Priority: 0/
Queue: Net-Twitter

People
Owner: cthom [...] cpan.org
Requestors: MMIMS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.20
Fixed in: (no value)



Subject: [Patch] relationship_exists *still* broken (blame Twitter)
Arrggg!!! Twitter is returning the *string* "true" or "false", not the boolean true or false. JSON::XS throws an exception. JSON::Syck returns the string "true" or "false". I haven't tested the other providers, but if they all handle JSON correctly, none of them will return what we want. I hadn't noticed there were two bug reports for relationship_exists. I replied to #41667 with a patch that you applied, which would have worked if Twitter was returning a valid boolean. The older report, #40835 includes a working patch. However, it will break if Twitter ever fixes it's API to return a proper boolean. So, attached is a patch to 1.20 that will work in either case. I'll also report the bug to Twitter if I don't find an existing bug report, there. -Marc
Subject: net-twitter.patch
diff --git a/lib/Net/Twitter.pm b/lib/Net/Twitter.pm index d42fbe4..f32b569 100755 --- a/lib/Net/Twitter.pm +++ b/lib/Net/Twitter.pm @@ -418,8 +418,8 @@ sub relationship_exists { my $req = $self->{ua}->get( $url ); $self->{response_code} = $req->code; $self->{response_message} = $req->message; - return ( $req->is_success ) ? JSON::Any->jsonToObj( $req->content ) : undef; - + return unless $req->is_success; + return $req->content =~ /true/ ? 1 : 0; } ########################################################################
This is fixed as of 1.21