NAME
WWW::LEO - Perl interface to the English-German online dictionary at http://dict.leo.org
SYNOPSIS
use WWW::LEO;
use Data::Dumper;
my $leo = WWW::LEO->new;
$leo->query("@ARGV");
if ($leo->num_results) {
my $i;
foreach my $resultpair (@{$leo->en_de}) {
printf "%3d: %-40s %s\n", ++$i, @$resultpair;
}
} else {
print "Sorry, your query for '%s'gave no results.\n", $leo->query;
}
DESCRIPTION
This module provides an interface to the English-German online dictionary located at http://dict.leo.org.
DEPRECATED
This module is superseded by WWW::Dict::Leo::Org. Please use WWW::Dict::Leo::Org.
METHODS
new-
This constructs a new
WWW::LEOobject. You can pass a hashref with configuration info to the constructor. Currently recognized key words are:agent-
sets the user agent string that is used to identify the module
query-
If a scalar is supplied, queries the dictionary for the string contained within. Returns the number of results.
If no argument is given, returns the query string of the last query. Returns
undefif no query has been made yet with this object. reset-
Resets the
WWW::LEOobject to the state as if no query had been made. Returns the resettedWWW::LEOobject.This method shouldn't be used in normal cases. It's there to provide the possibility of explicitely cleaning up the
WWW::LEOobject. agent-
Returns the
LWP::UserAgentobject thatWWW::LEOuses to query the dictionary. request-
Returns the
HTTP::Requestobject thatWWW::LEOpasses toLWP::UserAgentwhen quering the dictionary. response-
Returns the
HTTP::Responseobject that results from the query to the dictionary. num_results-
Returns the number of results of the last query.
Returns
undefif no query has been made. maxlen_de-
This is a convenience method: returns the longest string in of the English results.
Returns
undefif no query has been made. maxlen_en-
This is a convenience method: returns the longest string of the German results.
Returns
undefif no query has been made. en_de-
Returns a reference to an array whose elements are references to arrays containing the English and German result pairs in elements 0 and 1, respectively.
en-
Convenience method: Returns an array reference containing the English results.
de-
Convenience method: Returns an array reference containing the English results.
EXPORT
None, as this is an object-oriented module.
SEE ALSO
WWW::Dict::Leo::Org - a working alternative
the http://dict.leo.org homepage
the sample clients included with this package:
KNOWN BUGS AND OTHER ISSUES
The leo.org page layout changed, this module does not work anymore.
The parsing scheme used to extract the results could probably be improved to be more robust.
TODO
implement more robust parsing scheme
provide more flexibility for the user (constructor options, ...)
implement support for headlines ("Direct Matches (+ Prepositions)", "Composed Entries", ...) and other LEO options (see the web page)
Also see the TODO file contained in the module distribution.
SUPPORT
Please contact the current maintainer of this module to report any bugs or suggest changes to this module:
Jörg Ziefle <ziefle@cpan.org>
AUTHOR
Jörg Ziefle <ziefle@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2002 by Jörg Ziefle
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.