catch no $term

This commit is contained in:
TLINDEN
2016-10-09 11:17:14 +02:00
parent 173d8061d7
commit b7a77c4b72

11
Org.pm
View File

@@ -7,7 +7,7 @@
# or service marks of their respective holders. # or service marks of their respective holders.
package WWW::Dict::Leo::Org; package WWW::Dict::Leo::Org;
$WWW::Dict::Leo::Org::VERSION = "1.43"; $WWW::Dict::Leo::Org::VERSION = "1.44";
use strict; use strict;
use warnings; use warnings;
@@ -27,7 +27,7 @@ sub new {
my %settings = ( my %settings = (
"-Host" => "pda.leo.org", "-Host" => "pda.leo.org",
"-Port" => 80, "-Port" => 80,
"-UserAgent" => "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9", "-UserAgent" => "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
"-Proxy" => "", "-Proxy" => "",
"-ProxyUser" => "", "-ProxyUser" => "",
"-ProxyPass" => "", "-ProxyPass" => "",
@@ -36,7 +36,6 @@ sub new {
"-Morphology" => "standard", # none, forcedAll "-Morphology" => "standard", # none, forcedAll
"-CharTolerance" => "relaxed", # fuzzy, exact "-CharTolerance" => "relaxed", # fuzzy, exact
"-Language" => "en", # en2de, de2fr, fr2de, de2es, es2de "-Language" => "en", # en2de, de2fr, fr2de, de2es, es2de
"data" => {}, # the results "data" => {}, # the results
"section" => [], "section" => [],
"title" => "", "title" => "",
@@ -58,6 +57,10 @@ sub new {
sub translate { sub translate {
my($this, $term) = @_; my($this, $term) = @_;
if (! $term) {
croak "No term to translate given!";
}
my $linecount = 0; my $linecount = 0;
my $maxsize = 0; my $maxsize = 0;
my @match = (); my @match = ();
@@ -542,6 +545,6 @@ Please don't forget to add debugging output!
=head1 VERSION =head1 VERSION
1.43 1.44
=cut =cut