=head1 NAME REST::Google::Translate - OO interface to Google Translate API =head1 SYNOPSIS use REST::Google::Translate; REST::Google::Translate->http_referer('http://example.com'); my $res = REST::Google::Translate->new( q => 'hello world', langpair => 'en|it' ); die "response status failure" if $res->responseStatus != 200; my $translated = $res->responseData->translatedText; printf "Italian translation: %s\n", $translated; =head1 DESCRIPTION C provides OO interface to Google REST (aka AJAX) API for languages translation. =head1 METHODS =over =item __PACKAGE__->http_referer() Get/set HTTP C header. I Google says that you should supply a valid HTTP referer header each time you perform a request to their AJAX API, so C raises warning unless referer is specified. =item __PACKAGE__->new() C argument should contain a phrase for translation. C is used to specify translation languages. According to Google API documentation the langpair languages should be separated by "|" (pipe) sign. For complete list of language pairs and other arguments please refer to 'Google Translate AJAX API' documentation. E.g.: my $res = REST::Google::Translate->new( q => 'hello world', langpair => 'en|it' ); The code above will perform a following HTTP GET request: http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=hello%20world&langpair=en%7Cit I You can left protocol version number unspecified while making your searches since C is passed by default. =item responseData To access translated text you should use C method as follows $translated_text = $res->responseData->translatedText =back =head1 SEE ALSO L - the base class for this module; L - Google Translate AJAX API documentation; =head1 LICENSE AND COPYRIGHT Copyright 2008, Eugen Sobchenko and Sergey Sinkovskiy This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.