WWW-WWWJDIC/lib/WWW/WWWJDIC.pod
=encoding UTF-8
=head1 NAME
WWW::WWWJDIC - information about online Japanese dictionary WWWJDIC
=head1 SYNOPSIS
use utf8;
use WWW::WWWJDIC;
my $wj = WWW::WWWJDIC->new (mirror => 'usa');
print $wj->lookup_url ('日本'), "\n";
produces output
http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic?QMUJ%E6%97%A5%E6%9C%AC_3
(This example is included as L<F<synopsis.pl>|https://fastapi.metacpan.org/source/BKB/WWW-WWWJDIC-0.005/examples/synopsis.pl> in the distribution.)
=head1 VERSION
This documents WWW::WWWJDIC version 0.005
corresponding to git commit L<d12f085ac5039c3b3fec766b36c7995a022ce383|https://github.com/benkasminbullock/WWW-WWWJDIC/commit/d12f085ac5039c3b3fec766b36c7995a022ce383> released on Tue Feb 13 09:32:00 2018 +0900.
=head1 DESCRIPTION
Get information about the WWWJDIC online Japanese dictionaries.
=head1 FUNCTIONS
=head2 get_mirrors
my %mirrors = get_mirrors ();
Get a list of mirrors of WWWJDIC. The keys are arbitrary identifiers,
and the values are the URLs of the mirrors. As of this version, the
following sites are available:
=over
=item australia
L<http://nihongo.monash.edu/cgi-bin/wwwjdic>
=item canada
L<http://www.ottix.net/cgi-bin/wwwjdic/wwwjdic>
=item germany
L<http://wwwjdic.biz/cgi-bin/wwwjdic>
=item sweden
L<http://wwwjdic.se/cgi-bin/wwwjdic.cgi>
=item usa
L<http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic>
=back
=head1 METHODS
=head2 new
my $wwwjdic = WWW::WWWJDIC->new (mirror => "japan")
Create the object which extracts the information from WWWJDIC.
The arguments are a hash with the following keys:
=over
=item mirror
Set the mirror site to use for L</lookup_url>. The possible values can
be obtained from L</get_mirrors>. If you do not specify a mirror, the
current default value is C<usa>.
Please note that mirrors may change or go out of service, and new
mirrors may be created. The above mirrors are obtained using the
script F<boot/scrape-json.pl> in the git repository. This script is
not part of the CPAN distribution.
=back
=head2 lookup_url
my $url = $wwwjdic->lookup_url ($key);
Make a lookup url (the "backdoor URL") which links to a WWWJDIC
page. As of version 0.005, this URL goes to the combined
dictionary page.
=head1 SEE ALSO
=over
=item WWWJDIC user guide
L<WWWJDIC Japanese Dictionary Server User Guide|http://nihongo.monash.edu/wwwjdicinf.html>
=back
=head1 DEPENDENCIES
=over
=item L<URI::Escape>
This is used by L</lookup_url> to form the URL.
=item L<JSON::Parse>
This is used to parse the information about WWWJDIC, which is
internally stored in the JSON format.
=back
=head1 BUGS
=over
=item *
Mirrors (including the main edrdg one) frequently go out of service.
=item *
The return value of L</lookup_url> may become invalid as WWWJDIC's
options are often changed so that different letters and numbers are
used to indicate the various dictionaries.
=item *
There is no way to set the dictionary in L</lookup_url>.
=item *
There is no way to get the URL for the plain text output of WWWJDIC.
=back
=head1 HISTORY
I started this module as a scraper for the WWWJDIC web site in around
2009. I released it to CPAN in 2017, but with documentation unwritten
and with scraper code which no longer worked. Currently the only
active use I have for this module is to get the list of mirrors. In
version 0.003 I removed the scraper code, leaving only the method
L</lookup_url> and the function L</get_mirrors>.
Version 0.005 updates the mirror list to remove the Melbourne
University and "gengo.com" mirrors.
=head1 AUTHOR
Ben Bullock, <bkb@cpan.org>
=head1 COPYRIGHT & LICENCE
This package and associated files are copyright (C)
2009-2018
Ben Bullock.
You can use, copy, modify and redistribute this package and associated
files under the Perl Artistic Licence or the GNU General Public
Licence.