AltaVista::BabelFish - Perl OO interface to http://babelfish.altavista.com


$phish->get_native()

Like get_english() but returns the given language's name in the given language.

    my $german = $phish->get_native('de');
    # $german is 'Deutsch'
    
    This gets funky for some languages/character sets. See L<Locales::Language> for more info. 

$phish->get_target_languages_arrayref() Returns an array reference of the target languages for the given language or the current source language if nothing is specified. my $lang = 'it'; print $phish->get_english($lang) . " can be translated into the following languages:\n"; for(@{ $phish->get_target_languages_arrayref($lang) }) { print $phish->get_english($_), "\n"; } print $phish->get_english() . " can be translated into the following languages:\n"; for(@{ $phish->get_target_languages_arrayref() }) { print $phish->get_english($_), "\n"; } =head2 $phish->get_source_languages_arrayref() Returns an array reference of all the languages that can be translated into the given langauge. If no [valid] language is given, an array ref of all available source languages is returned my $can_be_translated_into_dutch_array_ref = $phish->get_source_languages_arrayref('nl'); my $all_source_languages_array_ref = $phish->get_source_languages_arrayref(); for my $src (@{ $phish->source_languages_arrayref }) { print $phish->get_english($src) . " can be translated into from the following languages:\n"; for($phish->get_source_languages_arrayref($src) }) { print $phish->english($_),"\n"; } } =head2 $phish->is_latest_version() Since its always possible that AltaVista could change around their site this module could need reconfigured on occasion. This function will check to see if your version is the latest. die $phish->get_errstr() if !$phish->is_latest_version(); or perhaps: update_modules_according_to_our_policy(ref $phish) if !$phish->is_latest_version(); If you have the IO::Redirect manpage installed, the verbose output from the the CPAN manpage module is stored in $phish->get_errstr() if there is a problem. Otherwise the the CPAN manpage functions will have output that you can't control, so its recommended you install the IO::Redirect manpage if its not already. =head2 $phish->get_languages_hashref() Returns a hashref of language info. It can be used to view all the available languages, their name, targets, and two letter code. It is probably most usefull if you need to reference what the two letter code is for a given langauge. use Data::Dumper; print Dumper $phish->get_languages_hashref; # AltaVista::BabelFish->get_languages_hashref works also =head2 $phish->fishinfo() Returns content for an html page (no header) if called via a browser (IE !-t STDIN) and a text page if via CLI (IE -t STDIN) In void context prints its info, otherwise it returns it. print CGI::header(); print $htmltop; print $phish->fishinfo(); # AltaVista::BabelFish->fishinfo() works also print $htmlbot; If given a true argument the language's $phish->get_native() is printed out along with it if its not the same as the english version.

$phish->get_native() results gets funky for some languages/character sets. See the Locales::Language manpage for more info.


DON'T PANIC Just a personal note about what this module means to me. I like it because it combines two of my favorite things: Perl and the world of Douglas Adams So I'd like to say "print $thanks for 1..1000000;" to Mr. Wall for Perl and to Mr. Adams: So long and thanks for all the fish, we'll miss you buddy :) =head1 SEE ALSO the LWP::UserAgent manpage, the CPAN manpage, the IO::Redirect manpage, the Locales::Language manpage =head1 AUTHOR Daniel Muey, http://drmuey.com/cpan_contact.pl =head1 COPYRIGHT AND LICENSE Copyright 2005 by Daniel Muey This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut