File: singular.pl

package info (click to toggle)
libwww-dict-leo-org-perl 2.02-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 208 kB
  • sloc: perl: 519; makefile: 2
file content (26 lines) | stat: -rwxr-xr-x 939 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl
use WWW::Dict::Leo::Org;

# configure access to dict.leo.org
my $leo = new WWW::Dict::Leo::Org(
                                  -UserAgent      => 'IE 19',
                                  #-Proxy         => 'http://127.0.0.1:3128',
                                  #-ProxyUser     => 'me',
                                  #-ProxyPass     => 'pw',
                                  -Debug          => 0,
                                  -SpellTolerance => 'on',
                                  -Morphology     => 'standard',
                                  -CharTolerance  => 'relaxed',
                                  -Language       => 'de2ru'
                                 );

# fetch matches
my @matches = $leo->translate(shift || die "Usage: $0 <term>\n");

# print the first, if any
if (@matches && $leo->lines() >= 1) {
  printf "%s\n", $matches[0]->{data}->[0]->{left};
}
else {
  print "fail\n";
}