From: Marius Gavrilescu Date: Sat, 8 Aug 2015 10:29:08 +0000 (+0300) Subject: Lowercase keys in strike_imdb response X-Git-Tag: 0.004003~1 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=35da92a0cebdbc84a7da992becc2338c5e9fab51;p=webservice-strike.git Lowercase keys in strike_imdb response --- diff --git a/lib/WebService/Strike.pm b/lib/WebService/Strike.pm index b985840..e59707e 100644 --- a/lib/WebService/Strike.pm +++ b/lib/WebService/Strike.pm @@ -56,7 +56,9 @@ sub strike_imdb { my $url = "$BASE_URL/media/imdb/?imdbid=$id"; my $response = _ht->get($url); return unless $response->{success}; - decode_json $response->{content} + my %imdb = %{decode_json $response->{content}}; + $imdb{lc $_} = delete $imdb{$_} for keys %imdb; ## no critic (ProhibitUselessTopic) + \%imdb } BEGIN { *strike = \&strike_query } @@ -88,8 +90,8 @@ WebService::Strike - Get torrent info from getstrike.net API say join ' ', @{$mp->file_names}; my $info = strike_imdb 'tt1520211'; - say 'IMDB ID ', $info->{imdbID}, ' is ', $info->{title}, ' (', $info->{year}, ')'; - say 'Plot (short): ', $info->{shortPlot}; + say 'IMDB ID ', $info->{imdbid}, ' is ', $info->{title}, ' (', $info->{year}, ')'; + say 'Plot (short): ', $info->{shortplot}; =head1 DESCRIPTION @@ -129,7 +131,7 @@ For example: =item B(I<$imdb_id>) Get informaton about a movie from IMDB. Takes an IMDB ID and returns a -hashef of unspecified format. +hashref of unspecified format. All keys are lowercased. =back