mirror of
https://codeberg.org/scip/leo.git
synced 2025-12-17 04:31:01 +01:00
added module usage sample
This commit is contained in:
1
MANIFEST
1
MANIFEST
@@ -3,5 +3,6 @@ Makefile.PL
|
|||||||
README
|
README
|
||||||
leo
|
leo
|
||||||
t/run.t
|
t/run.t
|
||||||
|
samples/singular.pl
|
||||||
Org.pm
|
Org.pm
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
|||||||
26
samples/singular.pl
Executable file
26
samples/singular.pl
Executable file
@@ -0,0 +1,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";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user