Permalink
Browse files

Merge https://github.com/Habbie/zeroclickinfo-goodies

  • Loading branch information...
2 parents d79a256 + 6453b6e commit fcc66b2c743b43c66140fef90cf2c88d954fb3bc @majuscule majuscule committed Jun 11, 2012
Showing with 23 additions and 0 deletions.
  1. +1 −0 dist.ini
  2. +22 −0 lib/DDG/Goodie/IDN.pm
View
@@ -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
View
@@ -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;

0 comments on commit fcc66b2

Please sign in to comment.