diff --git a/MANIFEST b/MANIFEST index b8ca4b5..d24907e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3,5 +3,6 @@ Makefile.PL README leo t/run.t +samples/singular.pl Org.pm MANIFEST diff --git a/samples/singular.pl b/samples/singular.pl new file mode 100755 index 0000000..cf5f4c4 --- /dev/null +++ b/samples/singular.pl @@ -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 \n"); + +# print the first, if any +if (@matches && $leo->lines() >= 1) { + printf "%s\n", $matches[0]->{data}->[0]->{left}; +} +else { + print "fail\n"; +}