sub GetWikipediaAbstract { my ($query) = @_; $query = &EncodeString($query); my $SearchURL = $WikipediaAPI_URL.$query; my $ua = LWP::UserAgent->new; $ua->timeout(1); $ua->agent('$ScriptUserAgent'); my $response = $ua->get($SearchURL); if ($response->is_success) { my $content = $response->decoded_content; $content = &EncodeUTF8($content); my $json_obj = new JSON; my $perl_data = $json_obj->decode($content); my ($jsonHash) = values %{ $perl_data->{query}->{pages} }; my $text = $jsonHash->{extract}; unless ($text eq "") {return $text} } }