Dylan Lloyd 2012-06-11 15:58:23 -04:00
commit fcc66b2c74
2 changed files with 23 additions and 0 deletions

View File

@ -29,6 +29,7 @@ Convert::Color = 0.08
Convert::Color::Library = 0.03
Math::Round = 0.06
Convert::Morse = 0.05
Net::IDN::Encode = 2.003
[Prereqs / TestRequires]
Test::More = 0.98

22
lib/DDG/Goodie/IDN.pm Normal file
View File

@ -0,0 +1,22 @@
package DDG::Goodie::IDN;
# ABSTRACT: Convert domain names from/to Punycode.
use DDG::Goodie;
use Net::IDN::Encode ':all';
use HTML::Entities;
triggers start => 'idn';
handle remainder => sub {
if(/^xn--/) {
return 'decoded IDN: '.encode_entities(domain_to_unicode($_));
}
else {
return 'encoded IDN: '.encode_entities(domain_to_ascii($_));
}
# return;
};
zci is_cached => 1;
1;