Skip to content

Commit

Permalink
Workaround for some JSON backends that don't decode booleans properly
Browse files Browse the repository at this point in the history
  • Loading branch information
semifor committed Jun 3, 2009
1 parent 9f3ae4b commit ca18bad
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
3.00003 2009-06-03
- Added a workaround for JSON backends that don't handle booleans properly

3.00002 2009-06-01
- Updated version requirements in Makefile.PL

Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ NAME
Net::Twitter - A perl interface to the Twitter API

VERSION
This document describes Net::Twitter version 3.00002
This document describes Net::Twitter version 3.00003

SYNOPSIS
use Net::Twitter;
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Identica.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package Net::Identica;
use Net::Twitter;

# use *all* digits for fBSD ports
our $VERSION = '3.00002';
our $VERSION = '3.00003';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Twitter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use Carp;
use Net::Twitter::Core;

# use *all* digits for fBSD ports
our $VERSION = '3.00002';
our $VERSION = '3.00003';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down
10 changes: 7 additions & 3 deletions lib/Net/Twitter/Core.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Net::Twitter::Core;
use 5.8.1;
use 5.008001;
use Moose;
use Carp;
use JSON::Any qw/XS DWIW JSON/;
Expand All @@ -11,7 +11,7 @@ use namespace::autoclean;
with 'MooseX::Traits';

# use *all* digits for fBSD ports
our $VERSION = '3.00002';
our $VERSION = '3.00003';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down Expand Up @@ -77,7 +77,11 @@ sub _parse_result {
my $content = $res->content;
$content =~ s/^"(true|false)"$/$1/;

my $obj = $self->_from_json($content);
# some JSON backends don't handle booleans correctly
# TODO: move this fix to JSON::Any
my $obj = $content eq 'true' ? 1
: $content eq 'false' ? ''
: $self->_from_json($content);

# Twitter sometimes returns an error with status code 200
if ( $obj && ref $obj eq 'HASH' && exists $obj->{error} ) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Twitter/OAuth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package Net::Twitter::OAuth;
use Net::Twitter;

# use *all* digits for fBSD ports
our $VERSION = '3.00002';
our $VERSION = '3.00003';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Twitter/Search.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package Net::Twitter::Search;
use Net::Twitter;

# use *all* digits for fBSD ports
our $VERSION = '3.00002';
our $VERSION = '3.00003';

$VERSION = eval $VERSION; # numify for warning-free dev releases

Expand Down

0 comments on commit ca18bad

Please sign in to comment.