NAME

WebService::EastCoJp::Dictionary - An interface for REST service of EAST.co.jp

SYNOPSIS

use WebService::EastCoJp::Dictionary;

die "Could not reach to the server."
    unless WebService::EastCoJp::Dictionary::can_reach_to_the_server( );

my $d = WebService::EastCoJp::Dictionary->new( );
$d->parameter->match( "EXACT" );

say $d->enja( "English" );
say $d->jaen( "日本語" );

my( $title, @contents ) = split "\t", $d->enja( "Japanese" );

$d->parameter->match( "STARTWITH" );
$d->parameter->page_size( 3 );

SAY_TRANSLATION:
foreach my $translation ( $d->enja( "loc" ) ) {
    my( $title, @contents ) = split "\t", $translation;

    my $head_message = "### $title ";
    my $length = length( $head_message )
                 + do { require bytes; bytes::length( $head_message ) };
    $length /= 2;
    say $head_message, "#" x ( 80 - $length );
    print map { "[ $_ ]\n" } @contents;
}

DESCRIPTION

This module is an interface for REST service of EAST.co.jp. The server offers the dictionary retrieval.

The server has URL of "http://www.btonic.com/ws/index.html".

The server has some services, which are:

- translate English into Japanese
- translate Japanese into English

ATTRIBUTES

This class has an attribute. The attribute isa WebService::EastCoJp::Dictionary::SearchDicItemParameter.

METHODS

Methods are:

- can_reach_to_the_server: test it
- enja: for translate English into Japanese
- jaen: for translate Japanese into English

Following methods are for developer:

- _search_dic_item_lite
- _get_dic_item_lite
can_reach_to_the_server

This method tests that this environment can reach to the server of EAST.co.jp.

enja

This method returns the translation of argument. This method will die when it fails in translation.

The returned value is Japanese.

jaen

This method returns the translation of argument. This method will die when fail translation.

The returned value is English.

jaja

This method has been reserved for the future.

This will describe a argument.

SEE ALSO

WebService::EastCoJp::Dictionary::SearchDicItemParameter WebService::EastCoJp::Dictionary::GetDicItemParameter WebService::EastCoJp::Dictionary::ParameterConstraints

AUTHOR

Kuniyoshi Kouji, <kuniyoshi@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Kuniyoshi Kouji

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.