Jörg Ziefle > WWW-LEO-0.01 > WWW::LEO

Download:
WWW-LEO-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.01   Source  

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.

METHODS

new

This constructs a new WWW::LEO object. 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 undef if no query has been made yet with this object.

reset

Resets the WWW::LEO object to the state as if no query had been made. Returns the resetted WWW::LEO object.

This method shouldn't be used in normal cases. It's there to provide the possibility of explicitely cleaning up the WWW::LEO object.

agent

Returns the LWP::UserAgent object that WWW::LEO uses to query the dictionary.

request

Returns the HTTP::Request object that WWW::LEO passes to LWP::UserAgent when quering the dictionary.

response

Returns the HTTP::Response object that results from the query to the dictionary.

num_results

Returns the number of results of the last query.

Returns undef if no query has been made.

maxlen_de

This is a convenience method: returns the longest string in of the English results.

Returns undef if no query has been made.

maxlen_en

This is a convenience method: returns the longest string of the German results.

Returns undef if 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 ^

KNOWN BUGS AND OTHER ISSUES ^

TODO ^

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.

syntax highlighting: