Show
Ignore:
Timestamp:
03/01/08 02:49:05 (6 years ago)
Author:
woremacx
Message:

lang/perl/WebService-Nowa: decode json before parse it. add 'use Crypt::SSLeay'

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/WebService-Nowa/trunk/lib/WebService/Nowa.pm

    r7097 r7314  
    1717use JSON::Syck; 
    1818use WWW::Mechanize; 
     19use Crypt::SSLeay; 
    1920 
    2021use constant NOWA_HOME => 'http://my.nowa.jp/home/'; 
     
    163164    my $uri = URI->new_abs($method, NOWA_API_HOME); 
    164165    $self->{mech}->get($uri->as_string); 
    165     my $res = JSON::Syck::Load($self->{mech}->content); 
     166    my $content = Encode::decode('utf-8', $self->{mech}->content); 
     167    my $res = JSON::Syck::Load($content); 
    166168    croak "fetch recent failed." if ref($res) eq 'HASH' and $res->{result} eq 'fail'; 
    167169    $res; 
     
    185187 
    186188    $self->{mech}->get($uri->as_string); 
    187     my $res = JSON::Syck::Load($self->{mech}->content); 
     189    my $content = Encode::decode('utf-8', $self->{mech}->content); 
     190    my $res = JSON::Syck::Load($content); 
    188191    croak "fetch recent failed." if ref($res) eq 'HASH' and $res->{result} eq 'fail'; 
    189192    $res;