From 3b41cf4d203767f6d4dd235c9f060db7e5eaa512 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 28 Sep 2010 11:12:58 +0200 Subject: Simplify perl code, and fix handle multiline input in uriunescape(). --- localkannel-dispatch | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'localkannel-dispatch') diff --git a/localkannel-dispatch b/localkannel-dispatch index c967368..bb5a7c0 100755 --- a/localkannel-dispatch +++ b/localkannel-dispatch @@ -24,21 +24,17 @@ grepescape() { # Based on Text::Unidecode bug#8017: http://rt.cpan.org/Ticket/Display.html?id=8017#txn-322351 lctransliterate() { - echo "$1" | perl -n \ - -e 'use Text::Unidecode;' \ - -e 'use Encode 2.12 qw(encode decode _utf8_off);' \ + echo "$1" | perl -MText::Unidecode -MEncode \ -e 'print lc(decode("GSM0338", encode("GSM0338", decode("UTF-8", $_),' \ - -e 'sub {$a=unidecode(chr $_[0]); _utf8_off($a); $a;}' \ + -e 'sub {$a=unidecode(chr $_[0]); Encode::_utf8_off($a); $a;}' \ -e ')));' - - return $res; } uriunescape() { if [ 0 = "$urldecode" ]; then echo "$@" else - echo "$@" | perl -e 'use URI::Escape; print lc(uri_unescape());' + echo "$@" | perl -MURI::Escape -ne 'print lc(uri_unescape($_))' fi } -- cgit v1.2.3