The following functions are imported by default. If you also "use Net::IDN::Punycode", be sure to disable
import from this module:
use IDNA::Punycode();
idn_prefix($prefix)
Sets $IDNA::Punycode::PREFIX to $prefix.
Donotusethisfunction in larger applications or environments in which multiple application share
global variables (such as mod_perl). Instead, set the variable locally:
local $IDNA::Punycode::PREFIX = 'yo--';
encode_punycode($input)
If $IDNA::Punycode::PREFIX is '', encodes $input with Punycode.
If $IDNA::Punycode::PREFIX is not '', encodes $input with Punycode and adds the prefix if $input does
contain non-base characters (i. e. characters above U+007F). If $input does not contain any non-base
characters, it is returned as-is.
This function does not do any string preparation as specified by nameprep or other stringprep
profiles. Use Net::IDN::Encode if you just want to convert a domain name.
This function will croak on invalid input.
decode_punycode($input)
If $IDNA::Punycode::PREFIX is '', decodes $input with Punycode.
If $IDNA::Punycode::PREFIX is not '', checks whether $input starts with the prefix. If $input starts
with the prefix, the prefix is removed and the remainder is decoded with Punycode. If $input does not
start with the prefix, it is returned as-is.
Of course, this function does not do any string preparation as specified by nameprep or other
stringprep profiles (or some sort of de-preparation).
This function will croak on invalid input.