r2296 - in packages/libnet-domain-tld-perl/branches/upstream/current: . lib/Net/Domain t

gregor herrmann gregoa-guest at costa.debian.org
Thu Mar 9 16:19:20 UTC 2006


Author: gregoa-guest
Date: 2006-03-09 16:19:19 +0000 (Thu, 09 Mar 2006)
New Revision: 2296

Added:
   packages/libnet-domain-tld-perl/branches/upstream/current/Changes
   packages/libnet-domain-tld-perl/branches/upstream/current/META.yml
   packages/libnet-domain-tld-perl/branches/upstream/current/t/
   packages/libnet-domain-tld-perl/branches/upstream/current/t/01_ini.t
Removed:
   packages/libnet-domain-tld-perl/branches/upstream/current/test.pl
Modified:
   packages/libnet-domain-tld-perl/branches/upstream/current/MANIFEST
   packages/libnet-domain-tld-perl/branches/upstream/current/Makefile.PL
   packages/libnet-domain-tld-perl/branches/upstream/current/README
   packages/libnet-domain-tld-perl/branches/upstream/current/lib/Net/Domain/TLD.pm
Log:
Load /tmp/tmp.4r9k6d/libnet-domain-tld-perl-1.65 into
packages/libnet-domain-tld-perl/branches/upstream/current.


Added: packages/libnet-domain-tld-perl/branches/upstream/current/Changes
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/Changes	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/Changes	2006-03-09 16:19:19 UTC (rev 2296)
@@ -0,0 +1,18 @@
+Revision history for Net::Domain::TLD.
+
+1.05  Tue Jan 23 12:00:00 2001
+	- original version
+1.06  Mon Jan 23 16:00:00 2006
+	- minor documentation fix
+1.07  Tue Jan 24 18:00:00 2006
+	- minor code fix
+1.63  Wed Jan 25 12:00:00 2006
+	- Dropped OO code ( There are previous versions of module if anyone needs it ) 
+	- Fixed documentation and code indenting.
+	- Updated the tld profile with new iana assigned entries
+	- Rewrote "tlds" and "tld_exists subs", less code and tested them to ensure reliable operation
+	- "tld_exists" now also takes type which allows it to inspect specified profile type for that tld
+1.64  Wed Jan 25 13:00:00 2006
+	- minor documentation fix
+1.65  Wed Jan 25 18:00:00 2006
+	- minor documentation fix

Modified: packages/libnet-domain-tld-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/MANIFEST	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/MANIFEST	2006-03-09 16:19:19 UTC (rev 2296)
@@ -1,5 +1,8 @@
+Changes
+lib/Net/Domain/TLD.pm
+LICENSE
+Makefile.PL
 MANIFEST
-Makefile.PL
+META.yml
 README
-TLD.pm
-test.pl
+t/01_ini.t

Added: packages/libnet-domain-tld-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/META.yml	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/META.yml	2006-03-09 16:19:19 UTC (rev 2296)
@@ -0,0 +1,12 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Net-Domain-TLD
+version:      1.65
+version_from: lib/Net/Domain/TLD.pm
+installdirs:  site
+requires:
+    Carp:                          0
+    Storable:                      0
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Modified: packages/libnet-domain-tld-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/Makefile.PL	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/Makefile.PL	2006-03-09 16:19:19 UTC (rev 2296)
@@ -1,11 +1,13 @@
 use ExtUtils::MakeMaker;
 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
 # the contents of the Makefile that is written.
-push(@extras,
-    AUTHOR        => 'Alexander Pavlovic <alex-1 at telus.net>'
-        ) if ($ExtUtils::MakeMaker::Version >= 5.4301);
 WriteMakefile(
-    NAME		=> 'Net::Domain::TLD',
-    VERSION_FROM	=> 'TLD.pm', # finds $VERSION
-    PREREQ_PM		=> {Memoize => 0}, # e.g., Module::Name => 1.1
+    NAME         => 'Net::Domain::TLD',
+    VERSION_FROM => 'lib/Net/Domain/TLD.pm', # finds $VERSION
+    AUTHOR       => 'Alex Pavlovic (alex.pavlovic at taskforce-1.com)',
+    ABSTRACT     => 'Net::Domain::TLD - Work with TLD names',
+    PREREQ_PM   => {
+	'Carp'	=> '0', 
+	'Storable' => '0'
+    }
 );


Property changes on: packages/libnet-domain-tld-perl/branches/upstream/current/Makefile.PL
___________________________________________________________________
Name: svn:executable
   - 
   + *

Modified: packages/libnet-domain-tld-perl/branches/upstream/current/README
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/README	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/README	2006-03-09 16:19:19 UTC (rev 2296)
@@ -1,61 +1,59 @@
-NAME
-    Net::Domain::TLD - Gives ability to retrieve currently available tld
-    names/descriptions and perform verification of given tld name
+Net::Domain::TLD(3)   User Contributed Perl Documentation  Net::Domain::TLD(3)
 
-SYNOPSIS
-     use Net::Domain::TLD;
-     my $domain_list = Net::Domain::TLD->new;
-     my @ccTLDs = $domain_list->ccTLDs;
 
-DESCRIPTION
-    The purpose of this module is to provide user with current list of
-    available top level domain names including new ICANN additions and
-    ccTLDs
 
-INSTALL
-     perl Makefile.PL
-     make
-     make test
-     make install
+NNAAMMEE
+               Net::Domain::TLD - Work with TLD names
 
-PUBLIC INTERFACES
-    new Creates new Net::Domain::TLD instance
+SSYYNNOOPPSSIISS
+               use Net::Domain::TLD qw(tlds tld_exists);
+               my @ccTLDs = tlds('cc');
+               print "TLD ok\n" if tld_exists('ac');
 
-        my $tld = Net::Domain::TLD->new;
+DDEESSCCRRIIPPTTIIOONN
+               The purpose of this module is to provide user with current list of
+               available top level domain names including new ICANN additions and ccTLDs
+               Currently TLD definitions have been acquired from the following sources:
 
-    All
-         my @list = $tld->All;
+               http://www.icann.org/tlds/
+               http://www.dnso.org/constituency/gtld/gtld.html
+               http://www.iana.org/cctld/cctld-whois.htm
 
-        returns list or hash ref of all TLDs names/descriptions
+PPUUBBLLIICC MMEETTHHOODDSS
+               Each public function/method is described here.
+               These are how you should interact with this module.
 
-    TLDs_new
-         my @list = $tld->TLDs_new;
+       _"_t_l_d_s_"
 
-        returns list or hash ref of new TLD names/descriptions
+               my @all_tlds = tlds; #array of tlds
+               my $all_tlds = tlds; #hashref of tlds and their descriptions
 
-    gTLDs_open
-         my $names = $tld->gTLDs_open;
+               my @cc_tlds = tlds('cc'); #array of just 'cc' type tlds
+               my $cc_tlds = tlds('cc'); #hashref of just 'cc' type tlds and their descriptions
 
-        returns a list or hash ref of generic TLD names/descriptions
-        available to general public
+               Valid types are:
+                       cc                 - country code domains
+                       gtld_open          - generic domains that anyone can register
+                       gtld_restricted    - generic restricted registration domains
+                       new_open           - recently added generic domains
+                       new_restricted     - new restricted registration domains
 
-    gTLDs_restricted
-         my @list = $tld->gTLDs_restricted;
+       _"_t_l_d___e_x_i_s_t_s_"
 
-        returns a list or hash ref of generic TLD names/descriptions
-        restricted for assignment to specific users
+               die "no such domain" unless tld_exists($tld);
+               die "no such domain" unless tld_exists($tld, 'cc');
 
-    ccTLDs
-         my $names = $tld->ccTLDs;
+               This routine returns true if the given domain exists and false if it does not.
 
-        returns a list or hash ref of country code TLD names/descriptions
+CCOOPPYYRRIIGGHHTT
+               Copyright (c) 2003-2005 Alex Pavlovic, all rights reserved.  This program
+               is free software; you can redistribute it and/or modify it under the same terms
+               as Perl itself.
 
-    exists
-        determines if given tld exists, returns 1 if tld is valid and 0 if
-        not
+AAUUTTHHOORRSS
+               Alexander Pavlovic C<< <alex.pavlovic at taskforce-1.com> >>
+               Ricardo SIGNES C<< <rjbs at cpan.org> >>
 
-         $tld->exists(q{info}) ? print q{ok} : print q{not ok};
 
-AUTHOR
-    Alexander Pavlovic <alex-1 at telus.net>
 
+perl v5.8.7                       2006-01-25               Net::Domain::TLD(3)

Modified: packages/libnet-domain-tld-perl/branches/upstream/current/lib/Net/Domain/TLD.pm
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/lib/Net/Domain/TLD.pm	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/lib/Net/Domain/TLD.pm	2006-03-09 16:19:19 UTC (rev 2296)
@@ -1,428 +1,396 @@
 package Net::Domain::TLD;
+use base qw(Exporter);
+our @EXPORT_OK = qw(tlds tld_exists);
+our $VERSION = '1.65';
 
+use strict;
+use warnings;
+use Carp;
+use Storable qw ( dclone );
+
+use constant TLD_TYPES => qw ( new_open new_restricted gtld_open gtld_restricted cc );
+
 =head1 NAME
 
-Net::Domain::TLD - Gives ability to retrieve currently available tld 
-names/descriptions and perform verification of given tld name 
+	Net::Domain::TLD - Work with TLD names 
 
 =head1 SYNOPSIS
 
- use Net::Domain::TLD;
- my $domain_list = Net::Domain::TLD->new;
- my @ccTLDs = $domain_list->ccTLDs;
+	use Net::Domain::TLD qw(tlds tld_exists);
+	my @ccTLDs = tlds('cc');
+	print "TLD ok\n" if tld_exists('ac','cc');
 
 =head1 DESCRIPTION
 
-The purpose of this module is to provide user
-with current list of available top level domain names
-including new ICANN additions and ccTLDs
+	The purpose of this module is to provide user with current list of 
+	available top level domain names including new ICANN additions and ccTLDs
+	Currently TLD definitions have been acquired from the following sources:
 
-=head1 INSTALL
+	http://www.icann.org/tlds/
+	http://www.dnso.org/constituency/gtld/gtld.html
+	http://www.iana.org/cctld/cctld-whois.htm
 
- perl Makefile.PL
- make
- make test
- make install
-
-=head1 COPYRIGHT
-
-Copyright (c) 2003 Alexander Pavlovic. All rights reserved. This program is
-free software; you can redistribute it and/or modify it under the same
-terms as Perl itself.
-
 =cut
 
-use strict;
-use warnings;
-use Memoize;
-
-use constant NEW_TLDS => '_newTLDs';
-use constant GENERIC_TLDS_OPEN => '_gTLDs_open';
-use constant GENERIC_TLDS_RESTRICTED => '_gTLDs_restricted';
-use constant CC_TLDS => '_ccTLDs';
-
-sub BEGIN {
-        our ($VERSION) = '$Revision: 1.5 $' =~ /Revision: ([\d.]+)/;
-}
-
-use constant TLD_PROFILE => {
-	#fetched from http://www.icann.org/tlds/
-	&NEW_TLDS => { 
-		q{aero} => q{Air-transport industry}, 
-		q{biz} => q{Businesses},
-		q{coop} => q{Cooperatives},
-		q{info} => q{Unrestricted use},
-		q{museum} => q{Museums},
-		q{name} => q{For registration by individuals},
-		q{pro} => q{Accountants, lawyers, and physicians},
+my %tld_profile = (
+	new_open => { 
+		info => q{Unrestricted use},
 	},
-	#fetched from http://www.dnso.org/constituency/gtld/gtld.html 
-	#specific defininitions from http://whatis.techtarget.com
-	&GENERIC_TLDS_OPEN => {
-		q{com} => q{Commercial organization},
-		q{net} => q{Network connection services provider},
-		q{org} => q{Non-profit organizations and industry standard groups}
+	new_restricted => { 
+		aero => q{Air-transport industry}, 
+		arpa => q{Address and Routing Parameter Area},
+		biz => q{Businesses},
+		cat => q{Catalan linguistic and cultural community},
+		coop => q{Cooperatives},
+		jobs => q{Human Resource Management},
+		mobi => q{Mobile},
+		museum => q{Museums},
+		name => q{For registration by individuals},
+		pro => q{Accountants, lawyers, and physicians},
+		travel => q{Travel industry}
 	},
-	&GENERIC_TLDS_RESTRICTED => {
-		q{gov} => q{United States Government},
-		q{mil} => q{United States Military},
-		q{edu} => q{Educational institution},
-		q{int} => q{International treaties/databases}
+	gtld_open => {
+		com => q{Commercial organization},
+		net => q{Network connection services provider},
+		org => q{Non-profit organizations and industry standard groups}
 	},
-	#fetched from http://www.iana.org/cctld/cctld-whois.htm
-	&CC_TLDS => {
-		q{ac} => q{Ascension Island},
-		q{ad} => q{Andorra},
-		q{ae} => q{United Arab Emirates},
-		q{af} => q{Afghanistan},
-		q{ag} => q{Antigua and Barbuda},
-		q{ai} => q{Anguilla},
-		q{al} => q{Albania},
-		q{am} => q{Armenia},
-		q{an} => q{Netherlands Antilles},
-		q{ao} => q{Angola},
-		q{aq} => q{Antartica},
-		q{ar} => q{Argentina},
-		q{as} => q{American Samoa},
-		q{at} => q{Austria},
-		q{au} => q{Australia},
-		q{aw} => q{Aruba},
-		q{az} => q{Azerbaijan},
-		q{ba} => q{Bosnia and Herzegovina},
-		q{bb} => q{Barbados},
-		q{bd} => q{Bangladesh},
-		q{be} => q{Belgium},
-		q{bf} => q{Burkina Faso},
-		q{bg} => q{Bulgaria},
-		q{bh} => q{Bahrain},
-		q{bi} => q{Burundi},
-		q{bj} => q{Benin},
-		q{bm} => q{Bermuda},
-		q{bn} => q{Brunei Darussalam},
-		q{bo} => q{Bolivia},
-		q{br} => q{Brazil},
-		q{bs} => q{Bahamas},
-		q{bt} => q{Bhutan},
-		q{bv} => q{Bouvet Island},
-		q{bw} => q{Botswana},
-		q{by} => q{Belarus},
-		q{bz} => q{Belize},
-		q{ca} => q{Canada},
-		q{cc} => q{Cocos (Keeling) Islands},
-		q{cd} => q{Congo, Democratic Republic of the},
-		q{cf} => q{Central African Republic},
-		q{cg} => q{Congo, Republic of},
-		q{ch} => q{Switzerland},
-		q{ci} => q{Cote d'Ivoire},
-		q{ck} => q{Cook Islands},
-		q{cl} => q{Chile},
-		q{cm} => q{Cameroon},
-		q{cn} => q{China},
-		q{co} => q{Colombia},
-		q{cr} => q{Costa Rica},
-		q{cu} => q{Cuba},
-		q{cv} => q{Cap Verde},
-		q{cx} => q{Christmas Island},
-		q{cy} => q{Cyprus},
-		q{cz} => q{Czech Republic},
-		q{de} => q{Germany},
-		q{dj} => q{Djibouti},
-		q{dk} => q{Denmark},
-		q{dm} => q{Dominica},
-		q{do} => q{Dominican Republic},
-		q{dz} => q{Algeria},
-		q{ec} => q{Ecuador},
-		q{ee} => q{Estonia},
-		q{eg} => q{Egypt},
-		q{eh} => q{Western Sahara},
-		q{er} => q{Eritrea},
-		q{es} => q{Spain},
-		q{et} => q{Ethiopia},
-		q{fi} => q{Finland},
-		q{fj} => q{Fiji},
-		q{fk} => q{Falkland Islands (Malvina)},
-		q{fm} => q{Micronesia, Federal State of},
-		q{fo} => q{Faroe Islands},
-		q{fr} => q{France},
-		q{ga} => q{Gabon},
-		q{gd} => q{Grenada},
-		q{ge} => q{Georgia},
-		q{gf} => q{French Guiana},
-		q{gg} => q{Guernsey},
-		q{gh} => q{Ghana},
-		q{gi} => q{Gibraltar},
-		q{gl} => q{Greenland},
-		q{gm} => q{Gambia},
-		q{gn} => q{Guinea},
-		q{gp} => q{Guadeloupe},
-		q{gq} => q{Equatorial Guinea},
-		q{gr} => q{Greece},
-		q{gs} => q{South Georgia and the South Sandwich Islands},
-		q{gt} => q{Guatemala},
-		q{gu} => q{Guam},
-		q{gw} => q{Guinea-Bissau},
-		q{gy} => q{Guyana},
-		q{hk} => q{Hong Kong},
-		q{hm} => q{Heard and McDonald Islands},
-		q{hn} => q{Honduras},
-		q{hr} => q{Croatia/Hrvatska},
-		q{ht} => q{Haiti},
-		q{hu} => q{Hungary},
-		q{id} => q{Indonesia},
-		q{ie} => q{Ireland},
-		q{il} => q{Israel},
-		q{im} => q{Isle of Man},
-		q{in} => q{India},
-		q{io} => q{British Indian Ocean Territory},
-		q{iq} => q{Iraq},
-		q{ir} => q{Iran (Islamic Republic of)},
-		q{is} => q{Iceland},
-		q{it} => q{Italy},
-		q{je} => q{Jersey},
-		q{jm} => q{Jamaica},
-		q{jo} => q{Jordan},
-		q{jp} => q{Japan},
-		q{ke} => q{Kenya},
-		q{kg} => q{Kyrgyzstan},
-		q{kh} => q{Cambodia},
-		q{ki} => q{Kiribati},
-		q{km} => q{Comoros},
-		q{kn} => q{Saint Kitts and Nevis},
-		q{kp} => q{Korea, Democratic People's Republic},
-		q{kr} => q{Korea, Republic of},
-		q{kw} => q{Kuwait},
-		q{ky} => q{Cayman Islands},
-		q{kz} => q{Kazakhstan},
-		q{la} => q{Lao People's Democratic Republic},
-		q{lb} => q{Lebanon},
-		q{lc} => q{Saint Lucia},
-		q{li} => q{Liechtenstein},
-		q{lk} => q{Sri Lanka},
-		q{lr} => q{Liberia},
-		q{ls} => q{Lesotho},
-		q{lt} => q{Lithuania},
-		q{lu} => q{Luxembourg},
-		q{lv} => q{Latvia},
-		q{ly} => q{Libyan Arab Jamahiriya},
-		q{ma} => q{Morocco},
-		q{mc} => q{Monaco},
-		q{md} => q{Moldova, Republic of},
-		q{mg} => q{Madagascar},
-		q{mh} => q{Marshall Islands},
-		q{mk} => q{Macedonia, Former Yugoslav Republic},
-		q{ml} => q{Mali},
-		q{mm} => q{Myanmar},
-		q{mn} => q{Mongolia},
-		q{mo} => q{Macau},
-		q{mp} => q{Northern Mariana Islands},
-		q{mq} => q{Martinique},
-		q{mr} => q{Mauritania},
-		q{ms} => q{Montserrat},
-		q{mt} => q{Malta},
-		q{mu} => q{Mauritius},
-		q{mv} => q{Maldives},
-		q{mw} => q{Malawi},
-		q{mx} => q{Mexico},
-		q{my} => q{Malaysia},
-		q{mz} => q{Mozambique},
-		q{na} => q{Namibia},
-		q{nc} => q{New Caledonia},
-		q{ne} => q{Niger},
-		q{nf} => q{Norfolk Island},
-		q{ng} => q{Nigeria},
-		q{ni} => q{Nicaragua},
-		q{nl} => q{Netherlands},
-		q{no} => q{Norway},
-		q{np} => q{Nepal},
-		q{nr} => q{Nauru},
-		q{nu} => q{Niue},
-		q{nz} => q{New Zealand},
-		q{om} => q{Oman},
-		q{pa} => q{Panama},
-		q{pe} => q{Peru},
-		q{pf} => q{French Polynesia},
-		q{pg} => q{Papua New Guinea},
-		q{ph} => q{Philippines},
-		q{pk} => q{Pakistan},
-		q{pl} => q{Poland},
-		q{pm} => q{St. Pierre and Miquelon},
-		q{pn} => q{Pitcairn Island},
-		q{pr} => q{Puerto Rico},
-		q{ps} => q{Palestinian Territories},
-		q{pt} => q{Portugal},
-		q{pw} => q{Palau},
-		q{py} => q{Paraguay},
-		q{qa} => q{Qatar},
-		q{re} => q{Reunion Island},
-		q{ro} => q{Romania},
-		q{ru} => q{Russian Federation},
-		q{rw} => q{Rwanda},
-		q{sa} => q{Saudi Arabia},
-		q{sb} => q{Solomon Islands},
-		q{sc} => q{Seychelles},
-		q{sd} => q{Sudan},
-		q{se} => q{Sweden},
-		q{sg} => q{Singapore},
-		q{sh} => q{St. Helena},
-		q{si} => q{Slovenia},
-		q{sj} => q{Svalbard and Jan Mayen Islands},
-		q{sk} => q{Slovak Republic},
-		q{sl} => q{Sierra Leone},
-		q{sm} => q{San Marino},
-		q{sn} => q{Senegal},
-		q{so} => q{Somalia},
-		q{sr} => q{Suriname},
-		q{st} => q{Sao Tome and Principe},
-		q{sv} => q{El Salvador},
-		q{sy} => q{Syrian Arab Republic},
-		q{sz} => q{Swaziland},
-		q{tc} => q{Turks and Caicos Islands},
-		q{td} => q{Chad},
-		q{tf} => q{French Southern Territories},
-		q{tg} => q{Togo},
-		q{th} => q{Thailand},
-		q{tj} => q{Tajikistan},
-		q{tk} => q{Tokelau},
-		q{tm} => q{Turkmenistan},
-		q{tn} => q{Tunisia},
-		q{to} => q{Tonga},
-		q{tp} => q{East Timor},
-		q{tr} => q{Turkey},
-		q{tt} => q{Trinidad and Tobago},
-		q{tv} => q{Tuvalu},
-		q{tw} => q{Taiwan},
-		q{tz} => q{Tanzania},
-		q{ua} => q{Ukraine},
-		q{ug} => q{Uganda},
-		q{uk} => q{United Kingdom},
-		q{um} => q{US Minor Outlying Islands},
-		q{us} => q{United States},
-		q{uy} => q{Uruguay},
-		q{uz} => q{Uzbekistan},
-		q{va} => q{Holy See (City Vatican State)},
-		q{vc} => q{Saint Vincent and the Grenadines},
-		q{ve} => q{Venezuela},
-		q{vg} => q{Virgin Islands (British)},
-		q{vi} => q{Virgin Islands (USA)},
-		q{vn} => q{Vietnam},
-		q{vu} => q{Vanuatu},
-		q{wf} => q{Wallis and Futuna Islands},
-		q{ws} => q{Western Samoa},
-		q{ye} => q{Yemen},
-		q{yt} => q{Mayotte},
-		q{yu} => q{Yugoslavia},
-		q{za} => q{South Africa},
-		q{zm} => q{Zambia},
-		q{zw} => q{Zimbabwe}
+	gtld_restricted => {
+		gov => q{United States Government},
+		mil => q{United States Military},
+		edu => q{Educational institution},
+		int => q{International treaties/databases},
+	},
+	cc => {
+		ac => q{Ascension Island},
+		ad => q{Andorra},
+		ae => q{United Arab Emirates},
+		af => q{Afghanistan},
+		ag => q{Antigua and Barbuda},
+		ai => q{Anguilla},
+		al => q{Albania},
+		am => q{Armenia},
+		an => q{Netherlands Antilles},
+		ao => q{Angola},
+		aq => q{Antartica},
+		ar => q{Argentina},
+		as => q{American Samoa},
+		at => q{Austria},
+		au => q{Australia},
+		aw => q{Aruba},
+		az => q{Azerbaijan},
+		ba => q{Bosnia and Herzegovina},
+		bb => q{Barbados},
+		bd => q{Bangladesh},
+		be => q{Belgium},
+		bf => q{Burkina Faso},
+		bg => q{Bulgaria},
+		bh => q{Bahrain},
+		bi => q{Burundi},
+		bj => q{Benin},
+		bm => q{Bermuda},
+		bn => q{Brunei Darussalam},
+		bo => q{Bolivia},
+		br => q{Brazil},
+		bs => q{Bahamas},
+		bt => q{Bhutan},
+		bv => q{Bouvet Island},
+		bw => q{Botswana},
+		by => q{Belarus},
+		bz => q{Belize},
+		ca => q{Canada},
+		cc => q{Cocos (Keeling) Islands},
+		cd => q{Congo, Democratic Republic of the},
+		cf => q{Central African Republic},
+		cg => q{Congo, Republic of},
+		ch => q{Switzerland},
+		ci => q{Cote d'Ivoire},
+		ck => q{Cook Islands},
+		cl => q{Chile},
+		cm => q{Cameroon},
+		cn => q{China},
+		co => q{Colombia},
+		cr => q{Costa Rica},
+		cu => q{Cuba},
+		cv => q{Cap Verde},
+		cx => q{Christmas Island},
+		cy => q{Cyprus},
+		cz => q{Czech Republic},
+		de => q{Germany},
+		dj => q{Djibouti},
+		dk => q{Denmark},
+		dm => q{Dominica},
+		do => q{Dominican Republic},
+		dz => q{Algeria},
+		ec => q{Ecuador},
+		ee => q{Estonia},
+		eg => q{Egypt},
+		eh => q{Western Sahara},
+		er => q{Eritrea},
+		es => q{Spain},
+		et => q{Ethiopia},
+		eu => q{European Union},
+		fi => q{Finland},
+		fj => q{Fiji},
+		fk => q{Falkland Islands (Malvina)},
+		fm => q{Micronesia, Federal State of},
+		fo => q{Faroe Islands},
+		fr => q{France},
+		ga => q{Gabon},
+		gb => q{United Kingdom},
+		gd => q{Grenada},
+		ge => q{Georgia},
+		gf => q{French Guiana},
+		gg => q{Guernsey},
+		gh => q{Ghana},
+		gi => q{Gibraltar},
+		gl => q{Greenland},
+		gm => q{Gambia},
+		gn => q{Guinea},
+		gp => q{Guadeloupe},
+		gq => q{Equatorial Guinea},
+		gr => q{Greece},
+		gs => q{South Georgia and the South Sandwich Islands},
+		gt => q{Guatemala},
+		gu => q{Guam},
+		gw => q{Guinea-Bissau},
+		gy => q{Guyana},
+		hk => q{Hong Kong},
+		hm => q{Heard and McDonald Islands},
+		hn => q{Honduras},
+		hr => q{Croatia/Hrvatska},
+		ht => q{Haiti},
+		hu => q{Hungary},
+		id => q{Indonesia},
+		ie => q{Ireland},
+		il => q{Israel},
+		im => q{Isle of Man},
+		in => q{India},
+		io => q{British Indian Ocean Territory},
+		iq => q{Iraq},
+		ir => q{Iran (Islamic Republic of)},
+		is => q{Iceland},
+		it => q{Italy},
+		je => q{Jersey},
+		jm => q{Jamaica},
+		jo => q{Jordan},
+		jp => q{Japan},
+		ke => q{Kenya},
+		kg => q{Kyrgyzstan},
+		kh => q{Cambodia},
+		ki => q{Kiribati},
+		km => q{Comoros},
+		kn => q{Saint Kitts and Nevis},
+		kp => q{Korea, Democratic People's Republic},
+		kr => q{Korea, Republic of},
+		kw => q{Kuwait},
+		ky => q{Cayman Islands},
+		kz => q{Kazakhstan},
+		la => q{Lao People's Democratic Republic},
+		lb => q{Lebanon},
+		lc => q{Saint Lucia},
+		li => q{Liechtenstein},
+		lk => q{Sri Lanka},
+		lr => q{Liberia},
+		ls => q{Lesotho},
+		lt => q{Lithuania},
+		lu => q{Luxembourg},
+		lv => q{Latvia},
+		ly => q{Libyan Arab Jamahiriya},
+		ma => q{Morocco},
+		mc => q{Monaco},
+		md => q{Moldova, Republic of},
+		mg => q{Madagascar},
+		mh => q{Marshall Islands},
+		mk => q{Macedonia, Former Yugoslav Republic},
+		ml => q{Mali},
+		mm => q{Myanmar},
+		mn => q{Mongolia},
+		mo => q{Macau},
+		mp => q{Northern Mariana Islands},
+		mq => q{Martinique},
+		mr => q{Mauritania},
+		ms => q{Montserrat},
+		mt => q{Malta},
+		mu => q{Mauritius},
+		mv => q{Maldives},
+		mw => q{Malawi},
+		mx => q{Mexico},
+		my => q{Malaysia},
+		mz => q{Mozambique},
+		na => q{Namibia},
+		nc => q{New Caledonia},
+		ne => q{Niger},
+		nf => q{Norfolk Island},
+		ng => q{Nigeria},
+		ni => q{Nicaragua},
+		nl => q{Netherlands},
+		no => q{Norway},
+		np => q{Nepal},
+		nr => q{Nauru},
+		nu => q{Niue},
+		nz => q{New Zealand},
+		om => q{Oman},
+		pa => q{Panama},
+		pe => q{Peru},
+		pf => q{French Polynesia},
+		pg => q{Papua New Guinea},
+		ph => q{Philippines},
+		pk => q{Pakistan},
+		pl => q{Poland},
+		pm => q{St. Pierre and Miquelon},
+		pn => q{Pitcairn Island},
+		pr => q{Puerto Rico},
+		ps => q{Palestinian Territories},
+		pt => q{Portugal},
+		pw => q{Palau},
+		py => q{Paraguay},
+		qa => q{Qatar},
+		re => q{Reunion Island},
+		ro => q{Romania},
+		ru => q{Russian Federation},
+		rw => q{Rwanda},
+		sa => q{Saudi Arabia},
+		sb => q{Solomon Islands},
+		sc => q{Seychelles},
+		sd => q{Sudan},
+		se => q{Sweden},
+		sg => q{Singapore},
+		sh => q{St. Helena},
+		si => q{Slovenia},
+		sj => q{Svalbard and Jan Mayen Islands},
+		sk => q{Slovak Republic},
+		sl => q{Sierra Leone},
+		sm => q{San Marino},
+		sn => q{Senegal},
+		so => q{Somalia},
+		sr => q{Suriname},
+		st => q{Sao Tome and Principe},
+		su => q{Soviet Union},
+		sv => q{El Salvador},
+		sy => q{Syrian Arab Republic},
+		sz => q{Swaziland},
+		tc => q{Turks and Caicos Islands},
+		td => q{Chad},
+		tf => q{French Southern Territories},
+		tg => q{Togo},
+		th => q{Thailand},
+		tj => q{Tajikistan},
+		tk => q{Tokelau},
+		tl => q{Timor-Leste},
+		tm => q{Turkmenistan},
+		tn => q{Tunisia},
+		to => q{Tonga},
+		tp => q{East Timor},
+		tr => q{Turkey},
+		tt => q{Trinidad and Tobago},
+		tv => q{Tuvalu},
+		tw => q{Taiwan},
+		tz => q{Tanzania},
+		ua => q{Ukraine},
+		ug => q{Uganda},
+		uk => q{United Kingdom},
+		um => q{US Minor Outlying Islands},
+		us => q{United States},
+		uy => q{Uruguay},
+		uz => q{Uzbekistan},
+		va => q{Holy See (City Vatican State)},
+		vc => q{Saint Vincent and the Grenadines},
+		ve => q{Venezuela},
+		vg => q{Virgin Islands (British)},
+		vi => q{Virgin Islands (USA)},
+		vn => q{Vietnam},
+		vu => q{Vanuatu},
+		wf => q{Wallis and Futuna Islands},
+		ws => q{Western Samoa},
+		ye => q{Yemen},
+		yt => q{Mayotte},
+		yu => q{Yugoslavia},
+		za => q{South Africa},
+		zm => q{Zambia},
+		zw => q{Zimbabwe}
 	}
-};
+);
 
-=head1 PUBLIC INTERFACES
+my $flat_profile = flatten ( \%tld_profile );
 
-=over 4
+sub flatten {
+	my $hashref = shift;
+	my %results;
+	@results{ keys %{ $hashref->{$_} } } = values % { $hashref->{$_} }
+		for ( keys %$hashref );
+	return \%results;
+}
 
-=item new
-
-Creates new Net::Domain::TLD instance 
-
-my $tld = Net::Domain::TLD->new;
-
-=cut
-
-sub new {
-	for ( qw ( All TLDs_new gTLDs_open gTLDs_restricted ccTLDs exists ) ) {
-		memoize $_;
-	}
-	return bless {}, shift;
+sub check_type {
+	my $type = shift;
+	croak "unknown TLD type: $type" unless grep { $type eq $_ } TLD_TYPES;
+	return 1;
 }
 
-=item All 
+=head1 PUBLIC METHODS
 
- my @list = $tld->All;
+	Each public function/method is described here.
+	These are how you should interact with this module.
 
-returns list or hash ref of all TLDs names/descriptions
+=head3 C<< tlds >>
 
-=cut
+	This routine returns the tlds requested.
 
-sub All {
-	my %list;
-	for ( NEW_TLDS, GENERIC_TLDS_OPEN, GENERIC_TLDS_RESTRICTED, CC_TLDS ) {
-		@list{keys %{TLD_PROFILE->{$_}}} = values %{TLD_PROFILE->{$_}};
-	}
-	return wantarray ? keys %list : \%list;
-}
+	my @all_tlds = tlds; #array of tlds
+	my $all_tlds = tlds; #hashref of tlds and their descriptions
 
-=item TLDs_new 
+	my @cc_tlds = tlds('cc'); #array of just 'cc' type tlds
+	my $cc_tlds = tlds('cc'); #hashref of just 'cc' type tlds and their descriptions
 
- my @list = $tld->TLDs_new;
+	Valid types are:
+		cc                 - country code domains
+		gtld_open          - generic domains that anyone can register
+		gtld_restricted    - generic restricted registration domains
+		new_open           - recently added generic domains
+		new_restricted     - new restricted registration domains
 
-returns list or hash ref of new TLD names/descriptions
-
 =cut
 
-sub TLDs_new {
-	wantarray ? keys % { TLD_PROFILE->{&NEW_TLDS} } : TLD_PROFILE->{&NEW_TLDS};	
+sub tlds {
+	my $type = shift;
+	check_type ( $type ) if $type;
+	my $results = $type ? 
+		wantarray ? [ keys %{ $tld_profile{$type} } ] : 
+			dclone ( $tld_profile{$type} ) :
+		wantarray ? [ map { keys %$_ } values %tld_profile ] : 
+			$flat_profile;
+	return wantarray ? @$results : $results;
 }
 
-=item gTLDs_open
+=head3 C<< tld_exists >>
 
- my $names = $tld->gTLDs_open;
+	This routine returns true if the given domain exists and false otherwise.
 
-returns a list or hash ref of generic TLD names/descriptions available to general public
-
+	die "no such domain" unless tld_exists($tld); #call without tld type 
+	die "no such domain" unless tld_exists($tld, 'new_open'); #call with tld type
+		
 =cut
 
-sub gTLDs_open {
-	 wantarray ? keys % { TLD_PROFILE->{&GENERIC_TLDS_OPEN} } : TLD_PROFILE->{&GENERIC_TLDS_OPEN};
+sub tld_exists {
+	my ( $tld, $type )  = ( lc ( $_[0] ), $_[1] );
+	check_type ( $type ) if $type;
+	my $result = $type ? 
+		$tld_profile{$type}{$tld} ? 1 : 0 :
+		$flat_profile->{$tld} ? 1 : 0;
+	return $result;
 }
 
-=item gTLDs_restricted 
+=head1 COPYRIGHT
 
- my @list = $tld->gTLDs_restricted;
+	Copyright (c) 2003-2005 Alex Pavlovic, all rights reserved.  This program
+	is free software; you can redistribute it and/or modify it under the same terms
+	as Perl itself.
 
-returns a list or hash ref of generic TLD names/descriptions restricted for assignment to specific users
+=head1 AUTHORS
 
-=cut 
+	Alexander Pavlovic <alex.pavlovic at taskforce-1.com>
+	Ricardo SIGNES <rjbs at cpan.org>
 
-sub gTLDs_restricted {
-	 wantarray ? keys % { TLD_PROFILE->{&GENERIC_TLDS_RESTRICTED} } : TLD_PROFILE->{&GENERIC_TLDS_RESTRICTED};
-}
-
-=item ccTLDs
-
- my $names = $tld->ccTLDs;
-
-returns a list or hash ref of country code TLD names/descriptions 
-
 =cut
 
-sub ccTLDs {
-	my $self = shift;
-	wantarray ? keys % { TLD_PROFILE->{&CC_TLDS} } : TLD_PROFILE->{&CC_TLDS}; 
-}
-
-=item exists 
-
-determines if given tld exists, returns 1 if tld is valid and 0 if not
-
- $tld->exists(q{info}) ? print q{ok} : print q{not ok};
-
-=cut
-
-sub exists {
-	my ( $self, $tld ) = @_;
-	$tld = lc $tld;
-	$tld =~ s/\s+//g;
-	my $list = $self->All;
-	return exists $list->{$tld};
-}
-
 1;
-
-=back
-
-=head1 AUTHOR
-
-Alexander Pavlovic <alex-1 at telus.net>
-
-=cut

Added: packages/libnet-domain-tld-perl/branches/upstream/current/t/01_ini.t
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/t/01_ini.t	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/t/01_ini.t	2006-03-09 16:19:19 UTC (rev 2296)
@@ -0,0 +1,5 @@
+BEGIN { $| = 1; print "1..1\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use Net::Domain::TLD qw ( tlds tld_exists );
+$loaded = 1;
+print "ok 1\n";


Property changes on: packages/libnet-domain-tld-perl/branches/upstream/current/t/01_ini.t
___________________________________________________________________
Name: svn:executable
   + *

Deleted: packages/libnet-domain-tld-perl/branches/upstream/current/test.pl
===================================================================
--- packages/libnet-domain-tld-perl/branches/upstream/current/test.pl	2006-03-09 16:19:14 UTC (rev 2295)
+++ packages/libnet-domain-tld-perl/branches/upstream/current/test.pl	2006-03-09 16:19:19 UTC (rev 2296)
@@ -1,22 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-######################### We start with some black magic to print on failure.
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { $| = 1; print "1..1\n"; }
-END {print "not ok 1\n" unless $loaded;}
-use Net::Domain::TLD;
-$loaded = 1;
-print "ok 1\n";
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
-my $tld = Net::Domain::TLD->new;
-print qq{ok 2\n} if $tld->exists ( q{edu} );




More information about the Pkg-perl-cvs-commits mailing list