Locale::Country handles ISO country codes, but when one considers DNS TLDs, it lacks (IIRC) the Big Seven (com/edu/gov/int/mil/org/net) and most certainly does not include the new ICANN additions (aero/biz/info/name...).
I was going to write a module to do just that, but fortunately a quick search on CPAN turned up Net::Domain::TLD (which proves that its name is well chosen).
A minor quibble I have with the module is that the only interface it offers is object-oriented, and a procedural interface would do just fine. For instance, to get my list of TLDs one has to jump through new like so:
my @list = Net::Domain::TLD::new->All;
@list = Net::Domain::TLD::all;
would be adequate. Especially as two objects' All() methods are hardly likely to return different results... we are looking at class invariants here. Still, never mind, it gets the job done.
As long as the author tracks the bowel movements of ICANN regularly, to see what comes out, this module will save me effort. And that's the whole point.