The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 28
META.json 1616
META.yml 2122
lib/Net/Domain/ExpireDate.pm 156161
t/01.t 9290
5 files changed (This is a version diff) 287297
@@ -182,7 +182,13 @@ Revision history for Perl extension Net::Domain::ExpireDate.
 	- fixed test
 
 1.10 2013-Jan-14        Vladimir Melnichenko
-        - parse DD.MM.YYYY creation date
+    - parse DD.MM.YYYY creation date
 
 1.11 2013-Mar-20        Walery Studennikov
-        - fixed test
+    - fixed test
+
+1.12 2014-Mar-04        Alexander Nalobin
+    - added support for whois.nic.io server, thanx to Ivan Bessarabov
+
+1.13 2014-Mar-25        Alexander Nalobin
+    - fixed support of .jp domains
@@ -1,22 +1,33 @@
 {
-   "abstract" : "Net::Domain::ExpireDate -- obtain expiration date of domain names",
+   "abstract" : "unknown",
    "author" : [
       "unknown"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921",
+   "generated_by" : "ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.120351",
    "license" : [
-      "perl_5"
+      "unknown"
    ],
    "meta-spec" : {
       "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
       "version" : "2"
    },
    "name" : "Net-Domain-ExpireDate",
+   "no_index" : {
+      "directory" : [
+         "t",
+         "inc"
+      ]
+   },
    "prereqs" : {
+      "build" : {
+         "requires" : {
+            "ExtUtils::MakeMaker" : "0"
+         }
+      },
       "configure" : {
          "requires" : {
-            "Module::Build" : "0.40"
+            "ExtUtils::MakeMaker" : "0"
          }
       },
       "runtime" : {
@@ -27,17 +38,6 @@
          }
       }
    },
-   "provides" : {
-      "Net::Domain::ExpireDate" : {
-         "file" : "lib/Net/Domain/ExpireDate.pm",
-         "version" : "1.10"
-      }
-   },
    "release_status" : "stable",
-   "resources" : {
-      "license" : [
-         "http://dev.perl.org/licenses/"
-      ]
-   },
-   "version" : "1.10"
+   "version" : "1.13"
 }
@@ -1,23 +1,24 @@
---- #YAML:1.0
-name:               Net-Domain-ExpireDate
-version:            1.11
-abstract:           ~
-author:  []
-license:            unknown
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
+---
+abstract: unknown
+author:
+  - unknown
 build_requires:
-    ExtUtils::MakeMaker:  0
-requires:
-    Getopt::Long:     2
-    Net::Whois::Raw:  1
-    Time::Piece:      0
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.57_05
+  ExtUtils::MakeMaker: 0
+configure_requires:
+  ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.78, CPAN::Meta::Converter version 2.120351'
+license: unknown
 meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: Net-Domain-ExpireDate
+no_index:
+  directory:
+    - t
+    - inc
+requires:
+  Getopt::Long: 2
+  Net::Whois::Raw: 1
+  Time::Piece: 0
+version: 1.13
@@ -3,6 +3,11 @@ package Net::Domain::ExpireDate;
 use strict;
 use Time::Piece;
 use Net::Whois::Raw;
+use Encode;
+use utf8;
+
+binmode STDOUT, 'encoding(UTF-8)';
+binmode STDERR, 'encoding(UTF-8)';
 
 use constant FLG_EXPDATE => 0b0001;
 use constant FLG_CREDATE => 0b0010;
@@ -16,7 +21,7 @@ our @EXPORT = qw(
     $USE_REGISTRAR_SERVERS
 );
 
-our $VERSION = '1.11';
+our $VERSION = '1.13';
 
 our $USE_REGISTRAR_SERVERS;
 our $CACHE_DIR;
@@ -31,73 +36,67 @@ $USE_REGISTRAR_SERVERS = 0;
 $Net::Whois::Raw::OMIT_MSG = 2;
 $Net::Whois::Raw::CHECK_FAIL = 3;
 
-
 sub expire_date {
-    my ($domain, $format) = @_;
-
-    if ($USE_REGISTRAR_SERVERS == 0) {
-        return expire_date_query( $domain, $format, 1 )
-    } elsif ($USE_REGISTRAR_SERVERS == 1) {
-        return expire_date_query( $domain, $format, 0 )
-    } elsif ($USE_REGISTRAR_SERVERS == 2) {
-        return expire_date_query( $domain, $format, 0 )
-            || expire_date_query( $domain, $format, 1 );
-    }
+    my ( $domain, $format ) = @_;
 
-    return undef;
+    if ( $USE_REGISTRAR_SERVERS == 0 ) {
+        return _expire_date_query( $domain, $format, 1 );
+    }
+    elsif ( $USE_REGISTRAR_SERVERS == 1 ) {
+        return _expire_date_query( $domain, $format, 0 );
+    }
+    elsif ( $USE_REGISTRAR_SERVERS == 2 ) {
+        return _expire_date_query( $domain, $format, 0 )
+            || _expire_date_query( $domain, $format, 1 );
+    }
 }
 
 sub domain_dates {
-    my ($domain, $format) = @_;
+    my ( $domain, $format ) = @_;
 
     _config_netwhoisraw();
 
-    return undef unless ($domain =~ /(.+?)\.([^.]+)$/);
-    my ($name, $tld) = (lc $1, lc $2);
+    return  unless $domain =~ /(.+?)\.([^.]+)$/;
+    my ( $name, $tld ) = ( lc $1 , lc $2 );
 
     my $whois;
 
-    if ($USE_REGISTRAR_SERVERS == 0) {
+    if ( $USE_REGISTRAR_SERVERS == 0 ) {
         $whois = Net::Whois::Raw::whois( $domain, undef, 'QRY_FIRST' );
-    } elsif ($USE_REGISTRAR_SERVERS == 1) {
-        $whois = Net::Whois::Raw::whois( $domain, undef, 'QRY_LAST' );
-    } elsif ($USE_REGISTRAR_SERVERS == 2) {
-        $whois = Net::Whois::Raw::whois( $domain, undef, 'QRY_LAST' )
-               || Net::Whois::Raw::whois( $domain, undef, 'QRY_FIRST' )
     }
-
-    if ($format) {
-        return (domdates_fmt( $whois, $tld, $format ));
+    elsif ( $USE_REGISTRAR_SERVERS == 1 ) {
+        $whois = Net::Whois::Raw::whois( $domain, undef, 'QRY_LAST' );
     }
-    else {
-        return (domdates_int( $whois, $tld ));
+    elsif ( $USE_REGISTRAR_SERVERS == 2 ) {
+        $whois = Net::Whois::Raw::whois( $domain, undef, 'QRY_LAST'  )
+              || Net::Whois::Raw::whois( $domain, undef, 'QRY_FIRST' )
     }
 
-    return undef;
+    return domdates_fmt( $whois, $tld, $format )  if $format;
+
+    return domdates_int( $whois, $tld );
 }
 
-sub expire_date_query {
-    my ($domain, $format, $via_registry) = @_;
+sub _expire_date_query {
+    my ( $domain, $format, $via_registry ) = @_;
 
     _config_netwhoisraw();
 
-    return undef unless ($domain =~ /(.+?)\.([^.]+)$/);
-    my ($name, $tld) = (lc $1, lc $2);
+    return  unless $domain =~ /(.+?)\.([^.]+)$/;
+    my ( $name, $tld ) = ( lc $1, lc $2 );
 
     my $whois = Net::Whois::Raw::whois( $domain, undef, $via_registry ? 'QRY_FIRST' : 'QRY_LAST' );
 
-    if ($format) {
-        return expdate_fmt( $whois, $tld, $format );
-    } else {
-        return expdate_int( $whois, $tld );
-    }
+    return expdate_fmt( $whois, $tld, $format )  if $format;
+    
+    return expdate_int( $whois, $tld );
 }
 
 sub domdates_fmt {
-    my ($whois, $tld, $format, $flags) = @_;
+    my ( $whois, $tld, $format, $flags ) = @_;
     $format ||= '%Y-%m-%d';
 
-    my ($cre_date, $exp_date, $fre_date) = domdates_int( $whois, $tld, $flags );
+    my ( $cre_date, $exp_date, $fre_date ) = domdates_int( $whois, $tld, $flags );
 
     local $^W = 0;  # prevent warnings
 
@@ -105,56 +104,62 @@ sub domdates_fmt {
     $exp_date = $exp_date ? $exp_date->strftime( $format ) : '';
     $fre_date = $fre_date ? $fre_date->strftime( $format ) : '';
 
-    return ($cre_date, $exp_date, $fre_date);
+    return $cre_date, $exp_date, $fre_date;
 }
 
 sub expdate_fmt {
-    my ($whois, $tld, $format) = @_;
+    my ( $whois, $tld, $format ) = @_;
 
-    my ($cre_date, $exp_date) = domdates_fmt( $whois, $tld, $format, FLG_EXPDATE );
+    my ( $cre_date, $exp_date ) = domdates_fmt( $whois, $tld, $format, FLG_EXPDATE );
 
     return $exp_date;
 }
 
 sub credate_fmt {
-    my ($whois, $tld, $format) = @_;
+    my ( $whois, $tld, $format ) = @_;
 
-    my ($cre_date, $exp_date) = domdates_fmt( $whois, $tld, $format, FLG_CREDATE );
+    my ( $cre_date, $exp_date ) = domdates_fmt( $whois, $tld, $format, FLG_CREDATE );
 
     return $cre_date;
 }
 
 sub domdates_int {
-    my ($whois, $tld, $flags) = @_;
+    my ( $whois, $tld, $flags ) = @_;
     $tld ||= 'com';
     $flags ||= FLG_ALL;
 
-    if (isin( $tld, ['ru', 'su', 'xn--p1ai'] )) {
-        return (dates_int_ru( $whois ));
-    } else { # 'com', 'net', 'org', 'biz', 'info', 'us', 'uk', 'cc'
-        my $expdate = $flags & FLG_EXPDATE ? expdate_int_cno( $whois ) : undef;
-        my $credate = $flags & FLG_CREDATE ? credate_int_cno( $whois ) : undef;
-        return ($credate, $expdate);
+    if ( _isin( $tld, [ qw( ru su xn--p1ai ) ] ) ) {
+        return _dates_int_ru( $whois );
+    }
+
+    if ( $tld eq 'jp' ) {
+        $whois = eval { Encode::decode( 'UTF-8', $whois ) } || $whois;
     }
+
+    my $expdate = $flags & FLG_EXPDATE ? _expdate_int_cno( $whois ) : undef;
+    my $credate = $flags & FLG_CREDATE ? _credate_int_cno( $whois ) : undef;
+
+    return $credate, $expdate;
 }
 
 sub expdate_int {
-    my ($whois, $tld) = @_;
+    my ( $whois, $tld ) = @_;
+
+    my ( $cre_date, $exp_date, $fre_date ) = domdates_int( $whois, $tld, 1 );
 
-    my ($cre_date, $exp_date, $fre_date) = domdates_int( $whois, $tld, 1 );
     return $exp_date;
 }
 
 sub decode_date {
-    my ($date, $format) = @_;
-    return undef unless $date;
+    my ( $date, $format) = @_;
+    return  unless $date;
     $format ||= '%Y-%m-%d';
 
-    my $t;
-    eval { $t = Time::Piece->strptime($date, $format); };
-    if ($@) {
+    my $t = eval { Time::Piece->strptime( $date, $format ) };
+
+    if ( $@ ) {
         warn "Can't parse date: ($date, $format)";
-        return undef;
+        return;
     }
 
     return $t;
@@ -163,21 +168,21 @@ sub decode_date {
 # --- internal functions ----
 
 sub _config_netwhoisraw {
-    $Net::Whois::Raw::CACHE_DIR = $CACHE_DIR if $CACHE_DIR;
-    $Net::Whois::Raw::CACHE_TIME = $CACHE_TIME if $CACHE_TIME;
+    $Net::Whois::Raw::CACHE_DIR  = $CACHE_DIR   if $CACHE_DIR ;
+    $Net::Whois::Raw::CACHE_TIME = $CACHE_TIME  if $CACHE_TIME;
 }
 
-# extract expiration date from whois output for .com .net .org domains
-sub expdate_int_cno {
-    my ($whois) = @_;
-    return undef unless $whois;
+# extract expiration date from whois output
+sub _expdate_int_cno {
+    my ( $whois ) = @_;
+    return  unless $whois;
 
     # $Y - The year, including century
     # $y - The year within century (0-99)
     # $m - The month number (1-12)
     # $b - The month name
     # $d - The day of month (1-31)
-    my ($rulenum, $Y, $y, $m, $b, $d);
+    my ( $rulenum, $Y, $y, $m, $b, $d );
 
     # [whois.networksolutions.com]	Record expires on 27-Apr-2011.
     # [whois.opensrs.net]
@@ -187,7 +192,7 @@ sub expdate_int_cno {
     # [whois.ibi.net]			Record expires on........: 03-Jun-2005 EST.
     # [whois.gkg.net]			Expires on..............: 24-JAN-2003
     # [whois.enom.com]			Expiration date: 11 Jun 2005 14:22:48
-    if ($whois =~ m/\sexpir.+?:?\s+(\d{2})[- ](\w{3})[- ](\d{4})/is) {
+    if ( $whois =~ m/\sexpir.+?:?\s+(\d{2})[- ](\w{3})[- ](\d{4})/is ) {
         $rulenum = 1.1;	$d = $1; $b = $2; $Y = $3;
     # [whois.discount-domain.com]	Expiration Date: 02-Aug-2003 22:07:21
     # [whois.publicinterestregistry.net] Expiration Date:03-Mar-2004 05:00:00 UTC
@@ -195,8 +200,8 @@ sub expdate_int_cno {
     # [whois.nic.uk]			Renewal Date:   23-Jan-2006
     # [whois.aero]			    Expires On:18-May-2008 01:53:51 UTC
     # [whois.nic.me]			Domain Expiration Date:28-Aug-2012 17:57:10 UTC
-    # [whois.domainregistry.ie] 
-    } elsif ($whois =~ m/(?:Expi\w+|Renewal) (?:Date|On):\s*(\d{2})-(\w{3})-(\d{4})/is) {
+    # [whois.domainregistry.ie]
+    } elsif ( $whois =~ m/(?:Expi\w+|Renewal) (?:Date|On):\s*(\d{2})-(\w{3})-(\d{4})/is ) {
         $rulenum = 1.2;	$d = $1; $b = $2; $Y = $3;
     # [whois.bulkregister.com]		Record expires on 2003-04-25
     # [whois.bulkregister.com]		Record will be expiring on date: 2003-04-25
@@ -214,7 +219,8 @@ sub expdate_int_cno {
     # [whois.signaturedomains.com]	Expires on: 2003-11-05
     # [whois.1stdomain.net]		Domain expires: 2007-01-20.
     # [whois.easyspace.com]
-    } elsif ($whois =~ m&(?:Record |Domain )?(?:will )?(?:be )?expir(?:e|ed|es|ing)(?: on)?(?: date)?\s*[-:]?\s*(\d{4})[/-](\d{1,2})[/-](\d{1,2})&is) {
+    # [whois.centralnic.com]    Expiration Date:2014-05-13T23:59:59.0Z
+    } elsif ( $whois =~ m&(?:Record |Domain )?(?:will )?(?:be )?expir(?:e|ed|es|ing|ation)(?: on)?(?: date)?\s*[-:]?\s*(\d{4})[/-](\d{1,2})[/-](\d{1,2})&is ) {
         $rulenum = 2.1;	$Y = $1; $m = $2; $d = $3;
     # [whois.InternetNamesWW.com]	Expiry Date.......... 2009-06-16
     # [whois.aitdomains.com]		Expire on................ 2002-11-05 16:42:41.000
@@ -226,11 +232,12 @@ sub expdate_int_cno {
     # [whois.cira.ca]               Expiry date:           2015/12/27
     # [whois.kr]                    Expiration Date             : 2013. 03. 02.
     # [whois.nic.ir]                expire-date:   2015-05-26
-    } elsif ($whois =~ m&(?:Expiry Date|expire-date|Expire(?:d|s)? on|Valid[ -][Dd]ate|[Ee]xpiration [Dd]ate|Date of expiration|Renewal[- ][Dd]ate)(?:\.*|\s*):?\s+(\d{4})[/.-] ?(\d{2})[/.-] ?(\d{2})&si) {
+    # [whois.nic.io]                Expiry : 2017-01-25
+    } elsif ( $whois =~ m&(?:Expiry|Expiry Date|expire-date|Expire(?:d|s)? on|Valid[ -][Dd]ate|[Ee]xpiration [Dd]ate|Date of expiration|Renewal[- ][Dd]ate)(?:\.*|\s*):?\s+(\d{4})[/.-] ?(\d{2})[/.-] ?(\d{2})&si ) {
         $rulenum = 2.2;	$Y = $1; $m = $2; $d = $3;
     # [whois.oleane.net]		expires:        20030803
     # [whois.nic.it]			expire:      20051011
-    } elsif ($whois =~ m/expires?:\s+(\d{4})(\d{2})(\d{2})/is) {
+    } elsif ( $whois =~ m/expires?:\s+(\d{4})(\d{2})(\d{2})/is ) {
         $rulenum = 2.3;	$Y = $1; $m = $2; $d = $3;
     # [whois.ripe.net] .FI		expires:  1.9.2007
     # [whois.rnids.rs]          Expiration date: 15.09.2012 11:58:33
@@ -238,12 +245,12 @@ sub expdate_int_cno {
     # [whois.nic.im]            Expiry Date: 28/12/2012 00:59:59
     # [whois.isoc.org.il]       validity:     15-08-2012
     # [whois.register.bg]       expires at: 08/01/2013 00:00:00 EET
-    } elsif ($whois =~ m/(?:validity|Expiry Date|expires?(?: at)?|expiration date(?: \(dd\/mm\/yyyy\))?):\s+(\d{1,2})[.\/-](\d{1,2})[.\/-](\d{4})/is) {
+    } elsif ( $whois =~ m/(?:validity|Expiry Date|expires?(?: at)?|expiration date(?: \(dd\/mm\/yyyy\))?):\s+(\d{1,2})[.\/-](\d{1,2})[.\/-](\d{4})/is ) {
         $rulenum = 2.4; $Y = $3; $m = $2; $d = $1;
     # [whois.dotster.com]		Expires on: 12-DEC-05
     # [whois for domain rosemount.com] Expires on..............: 26-Oct-15
     # [whois.godaddy.com]		Expires on: 02-Mar-16
-    } elsif ($whois =~ m/Expires on\.*: (\d{2})-(\w{3})-(\d{2})/s) {
+    } elsif ( $whois =~ m/Expires on\.*: (\d{2})-(\w{3})-(\d{2})/s ) {
         $rulenum = 3;	$d = $1; $b = $2; $y = $3;
     # [whois.register.com]		Expires on..............: Tue, Aug 04, 2009
     # [whois.registrar.aol.com]	Expires on..............: Oct  5 2002 12:00AM
@@ -251,75 +258,69 @@ sub expdate_int_cno {
     # [whois.doregi.com]		Record expires on.......: Oct  28, 2011
     # [www.nic.ac]		        Expires : January 27 2019.
     # [whois.isnic.is]          expires:      September  5 2012
-    } elsif ($whois =~ m/(?:Record )?expires(?: on)?\.* ?:? +(?:\w{3}, )?(\w{3,9})\s{1,2}(\d{1,2}),? (\d{4})/is) {
+    } elsif ( $whois =~ m/(?:Record )?expires(?: on)?\.* ?:? +(?:\w{3}, )?(\w{3,9})\s{1,2}(\d{1,2}),? (\d{4})/is ) {
         $rulenum = 4.1;	$b = $1; $d = $2; $Y = $3;
     # [whois.domainpeople.com]		Expires on .............WED NOV 16 09:09:52 2011
     # [whois.e-names.org]		Expires after:   Mon Jun  9 23:59:59 2003
     # [whois.corporatedomains.com]	Created on..............: Mon, Nov 12, 2007
-    } elsif ($whois =~ m/(?:Created|Expires) (?:on|after)\s?\.*:?\s*\w{3},? (\w{3})\s{1,2}(\d{1,2})(?: \d{2}:\d{2}:\d{2})? (\d{4})?/is) {
+    } elsif ( $whois =~ m/(?:Created|Expires) (?:on|after)\s?\.*:?\s*\w{3},? (\w{3})\s{1,2}(\d{1,2})(?: \d{2}:\d{2}:\d{2})? (\d{4})?/is ) {
         $rulenum = 4.2;	$b = $1; $d = $2; $Y = $3;
     # [whois.enom.com]			Expiration date: Fri Sep 21 2012 13:45:09
     # [whois.enom.com]			Expires: Fri Sep 21 2012 13:45:09
     # [whois.neulevel.biz]		Domain Expiration Date: Fri Mar 26 23:59:59 GMT 2004
-    } elsif ($whois =~ m/(?:Domain )?(?:Expires|Expiration Date):\s+\w{3} (\w{3}) (\d{2}) (?:\d{2}:\d{2}:\d{2} \w{3}(?:[-+]\d{2}:\d{2})? )(\d{4})/is) {
+    } elsif ( $whois =~ m/(?:Domain )?(?:Expires|Expiration Date):\s+\w{3} (\w{3}) (\d{2}) (?:\d{2}:\d{2}:\d{2} \w{3}(?:[-+]\d{2}:\d{2})? )(\d{4})/is ) {
         $rulenum = 4.3; $b = $1; $d = $2; $Y = $3;
     # [rs.domainbank.net]		Record expires on 10-05-2003 11:21:25 AM
     # [whois.psi-domains.com]
     # [whois.namesecure.com]		Expires on 10-09-2011
     # [whois.catalog.com]		Record Expires on 08-24-2011
-    } elsif ($whois =~ m&expires.+?(\d{2})-(\d{2})-(\d{4})&is) {
+    } elsif ( $whois =~ m&expires.+?(\d{2})-(\d{2})-(\d{4})&is ) {
         $rulenum = 5.1;	$m = $1; $d = $2; $Y = $3;
     # [whois.stargateinc.com]		Expiration: 6/3/2004
     # [whois.bookmyname.com]		Expires on 11/26/2007 23:00:00
-    } elsif ($whois =~ m&(?:Expiration|Expires on):? (\d{1,2})[-/](\d{1,2})[-/](\d{4})&is) {
+    } elsif ( $whois =~ m&(?:Expiration|Expires on):? (\d{1,2})[-/](\d{1,2})[-/](\d{4})&is ) {
         $rulenum = 5.2;	$m = $1; $d = $2; $Y = $3;
     # [whois.belizenic.bz]		Expiration Date..: 15-01-2005 12:00:00
-    } elsif ($whois =~ m&Expiration Date.+?(\d{2})-(\d{2})-(\d{4}) \d{2}:\d{2}:\d{2}&is) {
+    } elsif ( $whois =~ m&Expiration Date.+?(\d{2})-(\d{2})-(\d{4}) \d{2}:\d{2}:\d{2}&is ) {
         $rulenum = 5.3;	$d = $1; $m = $2; $Y = $3;
     # edit for .uk domains: Adam McGreggor <cpan[...]amyl.org.uk>;
     # kudos on a typo to <ganesh[...]urchin.earth.li>, via irc.mysociety.org
     # [whois.nic.uk] Registered on: 21-Oct-2003
-    } elsif ($whois =~ m&Registered on.+?(\d{2})-(\w{3})-(\d{4})&is) {
+    } elsif ( $whois =~ m&Registered on.+?(\d{2})-(\w{3})-(\d{4})&is ) {
         $rulenum = 5.4; $d = $1; $b = $2; $Y = $3;
     # [whois.nordnet.net]		Record expires on 2010-Apr-03
     # [whois.nic.nu]			Record created on 1999-Apr-5.
     # [whois.alldomains.com]		Expires on..............: 2006-Jun-12
-    } elsif ($whois =~ m/(?:Record |Domain )?expires on\.*:? (\d{4})-(\w{3})-(\d{1,2})/is) {
+    } elsif ( $whois =~ m/(?:Record |Domain )?expires on\.*:? (\d{4})-(\w{3})-(\d{1,2})/is ) {
         $rulenum = 6;	$Y = $1; $b = $2; $d = $3;
     # [whois.enom.com]			Expiration date: 09/21/03 13:45:09
-    } elsif ($whois =~ m|Expiration date: (\d{2})/(\d{2})/(\d{2})|s) {
+    } elsif ( $whois =~ m|Expiration date: (\d{2})/(\d{2})/(\d{2})|s ) {
         $rulenum = 7;	$m = $1; $d = $2; $y = $3;
-    } elsif ($whois =~ m/Registered through- (\w{3}) (\w{3}) (\d{2}) (\d{4})/is) {
+    } elsif ( $whois =~ m/Registered through- (\w{3}) (\w{3}) (\d{2}) (\d{4})/is ) {
         $rulenum = 7.1; $b = $2; $d = $3; $Y = $4;
-    } elsif ($whois =~ m|Expires: (\d{2})/(\d{2})/(\d{2})|is) {
+    } elsif ( $whois =~ m|Expires: (\d{2})/(\d{2})/(\d{2})|is ) {
         $rulenum = 7.2;	$m = $1; $d = $2; $y = $3;
-    } elsif ($whois =~ m|Registered through- (\d{2})/(\d{2})/(\d{2})|is) {
+    } elsif ( $whois =~ m|Registered through- (\d{2})/(\d{2})/(\d{2})|is ) {
         $rulenum = 7.3; $m = $1; $d = $2; $y = $3;
     # [whois.jprs.jp]                   [有効期限]                      2006/12/31
-    } elsif ($whois =~ m{
-            \[ 
-            (?: 
-                有効期限
-                | \x1b\x24\x42\x4d\x2d\x38\x7a\x34\x7c\x38\x42\x1b\x28\x42
-            )
-            \]
-            \s+ ( \d{4} ) / ( \d{2} ) / ( \d{2} )
-        }sx
-    ) {
+    } elsif ( $whois =~ m{ \[有効期限\] \s+ ( \d{4} ) / ( \d{2} ) / ( \d{2} )}sx ) {
         $rulenum = 7.4; $Y = $1; $m = $2; $d = $3;
+    }
     # [whois.ua]			status:     OK-UNTIL 20121122000000
-    } elsif ($whois =~ m|status:\s+OK-UNTIL (\d{4})(\d{2})(\d{2})\d{6}|s) {
+    elsif ( $whois =~ m|status:\s+OK-UNTIL (\d{4})(\d{2})(\d{2})\d{6}|s ) {
         $rulenum = 7.5; $Y = $1; $m = $2; $d = $3;
     }
 
-    unless ($rulenum) {
+    unless ( $rulenum ) {
         warn "Can't recognise expiration date format: $whois\n";
-        return undef;
-    } else {
-        #warn "rulenum: $rulenum\n";
-    };
+        return;
+    }
+    else {
+        # warn "rulenum: $rulenum\n";
+    }
 
-    my ($fstr, $dstr) = ('', '');
+    my $fstr = '';
+    my $dstr = '';
     $fstr .= $Y ? '%Y ' : '%y ';
     $dstr .= $Y ? "$Y " : "$y ";
 
@@ -332,7 +333,7 @@ sub expdate_int_cno {
     else {
         $fstr .= '%m ';
     }
-    
+
     $dstr .= $b ? "$b " : "$m ";
 
     $fstr .= '%d';
@@ -341,68 +342,71 @@ sub expdate_int_cno {
     return decode_date( $dstr, $fstr );
 }
 
-
-# extract creation date from whois output for .com .net .org .uk domains
-sub credate_int_cno {
-    my ($whois) = @_;
-    return undef unless $whois;
+# extract creation date from whois output
+sub _credate_int_cno {
+    my ( $whois ) = @_;
+    return  unless $whois;
 
     # $Y - The year, including century
     # $y - The year within century (0-99)
     # $m - The month number (1-12)
     # $b - The month name
     # $d - The day of month (1-31)
-    my ($rulenum, $Y, $y, $m, $b, $d);
+    my ( $rulenum, $Y, $y, $m, $b, $d );
     # [whois.crsnic.net]		Creation Date: 06-sep-2000
     # [whois.afilias.info]		Created On:31-Jul-2001 08:42:21 UTC
     # [whois.enom.com]			Creation date: 11 Jun 2004 14:22:48
     # [whois for domain ibm.com] Record created on 19-Mar-1986.
     # [whois.nic.me]		Domain Create Date:28-Aug-2008 17:57:10 UTC
-    if ($whois =~ m/Creat(?:ion|ed On|e)[^:]*?:?\s*(\d{2})[- ](\w{3})[- ](\d{4})/is) {
+    if ( $whois =~ m/Creat(?:ion|ed On|e)[^:]*?:?\s*(\d{2})[- ](\w{3})[- ](\d{4})/is ) {
         $rulenum = 1.2;	$d = $1; $b = $2; $Y = $3;
     # [whois.nic.name]			Created On: 2002-02-08T14:56:54Z
     # [whois.worldsite.ws]		Domain created on 2002-10-29 03:54:36
     # [..cn]				Registration Date: 2003-03-19 08:06
-    } elsif ($whois =~ m/(?:Creat.+?|Registration Date):?\s*?(\d{4})[\/-](\d{1,2})[\/-](\d{1,2})/is) {
+    } elsif ( $whois =~ m/(?:Creat.+?|Registration Date):?\s*?(\d{4})[\/-](\d{1,2})[\/-](\d{1,2})/is ) {
         $rulenum = 2.1;	$Y = $1; $m = $2; $d = $3;
      # created: 16.12.2006
-     } elsif ($whois =~ m/(?:created|registered):\s+(\d{2})[-.](\d{2})[-.](\d{4})/is) {
+     } elsif ( $whois =~ m/(?:created|registered):\s+(\d{2})[-.](\d{2})[-.](\d{4})/is ) {
          $rulenum = 2.2;        $Y = $3; $m = $2; $d = $1;
     # [whois.org.ru] created: 2006.12.16
-    } elsif ($whois =~ m/(?:created|registered):\s+(\d{4})[-.](\d{2})[-.](\d{2})/is) {
+    } elsif ( $whois =~ m/(?:created|registered):\s+(\d{4})[-.](\d{2})[-.](\d{2})/is ) {
         $rulenum = 2.3;	$Y = $1; $m = $2; $d = $3;
     # [whois.nic.it]			created:     20000421
-    } elsif ($whois =~ m/created?:\s+(\d{4})(\d{2})(\d{2})/is) {
+    } elsif ( $whois =~ m/created?:\s+(\d{4})(\d{2})(\d{2})/is ) {
         $rulenum = 2.4;	$Y = $1; $m = $2; $d = $3;
     # [whois.relcom.net]		changed:      support@webnames.ru 20030815
-    } elsif ($whois =~ m/changed:.+?(\d{4})(\d{2})(\d{2})/is) {
+    } elsif ( $whois =~ m/changed:.+?(\d{4})(\d{2})(\d{2})/is ) {
         $rulenum = 2.5;	$Y = $1; $m = $2; $d = $3;
     # [whois.tv]			Record created on Feb 21 2001.
-    } elsif ($whois =~ m/Creat.+?:?\s*(?:\w{3}, )?(\w{3,9})\s{1,2}(\d{1,2}),? (\d{4})/is) {
+    } elsif ( $whois =~ m/Creat.+?:?\s*(?:\w{3}, )?(\w{3,9})\s{1,2}(\d{1,2}),? (\d{4})/is ) {
         $rulenum = 4.1;	$b = $1; $d = $2; $Y = $3;
     # [whois.dns.be]			Registered:  Wed Jan 17 2001
-    } elsif ($whois =~ m/Regist.+?:\s*\w{3} (\w{3})\s+(\d{1,2}) (?:\d{2}:\d{2}:\d{2} )?(\d{4})/is) {
+    } elsif ( $whois =~ m/Regist.+?:\s*\w{3} (\w{3})\s+(\d{1,2}) (?:\d{2}:\d{2}:\d{2} )?(\d{4})/is ) {
         $rulenum = 4.2;	$b = $1; $d = $2; $Y = $3;
     # [whois.whois.neulevel.biz]	Domain Registration Date: Wed Mar 27 00:01:00 GMT 2002
-    } elsif ($whois =~ m/Registration.*?:\s+\w{3} (\w{3}) (\d{2}) (?:\d{2}:\d{2}:\d{2} \w{3}(?:[-+]\d{2}:\d{2})? )?(\d{4})/is) {
+    } elsif ( $whois =~ m/Registration.*?:\s+\w{3} (\w{3}) (\d{2}) (?:\d{2}:\d{2}:\d{2} \w{3}(?:[-+]\d{2}:\d{2})? )?(\d{4})/is ) {
         $rulenum = 4.3; $b = $1; $d = $2; $Y = $3;
-    } elsif ($whois =~ m&created.+?(\d{2})-(\d{2})-(\d{4})&is) {
+    } elsif ( $whois =~ m&created.+?(\d{2})-(\d{2})-(\d{4})&is ) {
         $rulenum = 5.1;	$m = $1; $d = $2; $Y = $3;
     # [whois.belizenic.bz]		Creation Date....: 15-01-2003 05:00:00
-    } elsif ($whois =~ m&Creation Date.+?(\d{2})-(\d{2})-(\d{4}) \d{2}:\d{2}:\d{2}&is) {
+    } elsif ( $whois =~ m&Creation Date.+?(\d{2})-(\d{2})-(\d{4}) \d{2}:\d{2}:\d{2}&is ) {
         $rulenum = 5.3;	$d = $1; $m = $2; $Y = $3;
+    # [whois.jprs.jp]                   [登録年月日]                    2001/04/23
+    } elsif ( $whois =~ m{ \[登録年月日\] \s+ ( \d{4} ) / ( \d{2} ) / ( \d{2} ) }sx ) {
+        $rulenum = 7.4; $Y = $1; $m = $2; $d = $3;
     # [whois.ua]			created:    0-UANIC 20050104013013
-    } elsif ($whois =~ m|created:\s+0-UANIC (\d{4})(\d{2})(\d{2})\d{6}|s) {
+    } elsif ( $whois =~ m|created:\s+0-UANIC (\d{4})(\d{2})(\d{2})\d{6}|s ) {
         $rulenum = 7.5; $Y = $1; $m = $2; $d = $3;
     } else {
         warn "Can't recognise creation date format\n";
-        return undef;
+        return;
     }
 
-    my ($fstr, $dstr) = ('', '');
+    my $fstr = '';
+    my $dstr = '';
     $fstr .= $Y ? '%Y ' : '%y ';
     $dstr .= $Y ? "$Y " : "$y ";
-    
+
     if ( $b && length $b > 3 ) {
         $fstr .= '%B ';
     }
@@ -412,7 +416,7 @@ sub credate_int_cno {
     else {
         $fstr .= '%m ';
     }
-    
+
     $dstr .= $b ? "$b " : "$m ";
 
     $fstr .= '%d';
@@ -421,35 +425,33 @@ sub credate_int_cno {
     return decode_date( $dstr, $fstr );
 }
 
+# extract creation/expiration dates from whois output for .ru, .su and .рф domains
+sub _dates_int_ru {
+    my ( $whois ) = @_;
+    return  unless $whois;
 
+    my ( $reg_till, $free_date, $created );
 
-# extract creation/expiration dates from whois output for .ru and .su domains
-sub dates_int_ru {
-    my ($whois) = @_;
-    return undef unless $whois;
-
-    my ($reg_till, $free_date, $created);
-
-    if ($whois =~ /reg-till:\s*(.+?)\n/s) { $reg_till = $1; }
-    if ($whois =~ /payed-till:\s*(.+?)\n/s) { $reg_till = $1; }
-    if ($whois =~ /paid-till:\s*(.+?)\n/s) { $reg_till = $1; }
-    if ($whois =~ /free-date:\s*(.+?)\n/s) { $free_date = $1; }
-    if ($whois =~ /created:\s+([0-9.]+)\n/s) { $created = $1; }
-    if ($whois =~ /Delegated till\s*(.+?)\n/s) { $reg_till = $1; }
+    $reg_till  = $1  if $whois =~ /reg-till:\s*(.+?)\n/s     ;
+    $reg_till  = $1  if $whois =~ /payed-till:\s*(.+?)\n/s   ;
+    $reg_till  = $1  if $whois =~ /paid-till:\s*(.+?)\n/s    ;
+    $free_date = $1  if $whois =~ /free-date:\s*(.+?)\n/s    ;
+    $created   = $1  if $whois =~ /created:\s+([0-9.]+)\n/s  ;
+    $reg_till  = $1  if $whois =~ /Delegated till\s*(.+?)\n/s;
 
-    $reg_till =~ tr/./-/ if $reg_till;
-    $free_date =~ tr/./-/ if $free_date;
-    $created =~ tr/./-/ if $created;
+    $reg_till  =~ tr/./-/  if $reg_till;
+    $free_date =~ tr/./-/  if $free_date;
+    $created   =~ tr/./-/  if $created;
 
-    if ($created) {
+    if ( $created ) {
         # Guess reg-till date
         $created = decode_date( $created, '%Y-%m-%d' );
         my $t = $created;
 
-        if ($t && !$reg_till && !$free_date) {
+        if ( $t && !$reg_till && !$free_date ) {
             $t += 0;
-            while ($t < localtime()) {
-                $t += ONE_YEAR + ($t->is_leap_year() ? 1 : 0);
+            while ( $t < localtime() ) {
+                $t += ONE_YEAR + ( $t->is_leap_year() ? 1 : 0 );
             }
             $reg_till = $t->strftime( '%Y-%m-%d' );
         }
@@ -457,24 +459,27 @@ sub dates_int_ru {
 
     unless ( $reg_till || $free_date ) {
         warn "Can't obtain expiration date from ($reg_till)\n";
-        return undef;
+        return;
     }
 
-    $reg_till = decode_date( $reg_till );
+    $reg_till  = decode_date( $reg_till  );
     $free_date = decode_date( $free_date );
-    if (!$reg_till && $free_date) {
+
+    if ( !$reg_till && $free_date ) {
         $reg_till = $free_date - 33 * ONE_DAY;
     }
-    
-    return ($created, $reg_till, $free_date);
+
+    return $created, $reg_till, $free_date;
 }
 
-sub isin {
+sub _isin {
     my ( $val, $arr ) = @_;
-    return '' unless $arr;
-    foreach (@{$arr}) {
-        return 1 if ($_ eq $val);
+    return 0  unless $arr;
+
+    for ( @$arr ) {
+        return 1  if $_ eq $val;
     }
+
     return 0;
 }
 
@@ -485,7 +490,7 @@ sub import {
     no strict 'refs';
 
     # export subs
-    *{"$callpkg\::$_"} = \&{"$mypkg\::$_"} foreach ((@EXPORT, @_));
+    *{ "$callpkg\::$_" } = \&{ "$mypkg\::$_" }  for @EXPORT, @_;
 }
 
 
@@ -1,121 +1,119 @@
 #!/usr/bin/perl -w
 
 use strict;
-use lib qw(.);
+use lib '.';
 
 use Test::More;
 use Data::Dumper;
-use Net::Domain::ExpireDate;
-
 use POSIX;
-setlocale( &POSIX::LC_TIME, "en_US.UTF-8" );
-
-BEGIN { plan tests => 70 };
-
-ok(1); # If we made it this far, we're ok.
-
-#print join ';', domain_dates("alefclub.com", '%Y-%m-%d'), "\n";
-#print join ';', domain_dates("skyriver.ru", '%Y-%m-%d'), "\n";
-#print join ';', domain_dates("infocentr.ru", '%Y-%m-%d'), "\n";
-#exit;
-
-print " .com .net .org tests\n";
-is( expdate_fmt("\nRecord expires on 27-Apr-2011.\n"), '2011-04-27' );
-is( expdate_fmt("\nDomain expires: 24 Oct 2010\n"), '2010-10-24' );
-is( expdate_fmt("\nRecord expires on........: 03-Jun-2005 EST.\n"), '2005-06-03' );
-is( expdate_fmt("\nExpires on..............: 24-JAN-2003\n"), '2003-01-24' );
-is( expdate_fmt("\nExpiration Date: 02-Aug-2003 22:07:21\n"), '2003-08-02' );
-is( expdate_fmt("\nExpiration Date:03-Mar-2004 05:00:00 UTC\n"), '2004-03-03' );
-is( expdate_fmt("\nRecord expires on 2003-09-08\n"), '2003-09-08' );
-is( expdate_fmt("\nRecord expires:       2003-07-29 10:45:05 UTC\n"), '2003-07-29' );
-is( expdate_fmt("\nexpires:        2003-05-21 10:09:56\n"), '2003-05-21' );
-is( expdate_fmt("\nRecord expires on:       2010-04-07 00:00:00.0 ET\n"), '2010-04-07' );
-is( expdate_fmt("\nRecord expires on 2012-07-15 10:23:10.000\n"), '2012-07-15' );
-is( expdate_fmt("\nRecord expired on 2008/8/26\n"), '2008-08-26' );
-is( expdate_fmt("\nRecord expires:           2003-03-12 12:16:45\n"), '2003-03-12' );
-is( expdate_fmt("\nRecord expires on 2010-04-24 16:03:20+10\n"), '2010-04-24' );
-is( expdate_fmt("\nExpires on: 2003-11-05\n"), '2003-11-05' );
-is( expdate_fmt("\nDomain expires: 2007-01-20.\n"), '2007-01-20' );
-is( expdate_fmt("\nExpiry Date.......... 2009-06-16\n"), '2009-06-16' );
-is( expdate_fmt("\nExpire on................ 2002-11-05 16:42:41.000\n"), '2002-11-05' );
-is( expdate_fmt("\nValid Date     2010-11-02 05:21:35 EST\n"), '2010-11-02' );
-is( expdate_fmt("\nExpiration Date     : 2002-11-19 04:18:25-05\n"), '2002-11-19' );
-is( expdate_fmt("\nDate of expiration  : 2003-05-28 11:50:58\n"), '2003-05-28' );
-is( expdate_fmt("\nExpires on..............: 2006-07-24\n"), '2006-07-24' );
-is( expdate_fmt("\nexpires:        20030803\n"), '2003-08-03' );
-is( expdate_fmt("\nExpires on: 12-DEC-05\n"), '2005-12-12' );
-is( expdate_fmt("\nExpires on..............: Tue, Aug 04, 2009\n"), '2009-08-04' );
-is( expdate_fmt("\nExpires on..............: Oct  5 2002 12:00AM\n"), '2002-10-05' );
-
-is( expdate_fmt("\nRecord expires on December 05, 2004\n"), '2004-12-05' );
-
-is( expdate_fmt("\nRecord expires on.......: Oct  28, 2011\n"), '2011-10-28' );
-is( expdate_fmt("\nExpires on .............WED NOV 16 09:09:52 2011\n"), '2011-11-16' );
-is( expdate_fmt("\nExpires after:   Mon Jun  9 23:59:59 2003\n"), '2003-06-09' );
-is( expdate_fmt("\nRecord expires on 10-05-2003 11:21:25 AM\n"), '2003-10-05' );
-is( expdate_fmt("\nExpires on 10-09-2011\n"), '2011-10-09' );
-is( expdate_fmt("\nRecord Expires on 08-24-2011\n"), '2011-08-24' );
-is( expdate_fmt("\nExpiration: 6/3/2004\n"), '2004-06-03' );
-is( expdate_fmt("\nExpires on 11/26/2007 23:00:00\n"), '2007-11-26' );
-is( expdate_fmt("\nRecord expires on 2010-Apr-03\n"), '2010-04-03' );
-is( expdate_fmt("\nRecord expires on 2012-Apr-5.\n"), '2012-04-05' );
-is( expdate_fmt("\nExpires on..............: 2006-Jun-12\n"), '2006-06-12' );
-is( expdate_fmt("\nExpiration date: 09/21/03 13:45:09\n"), '2003-09-21' );
+setlocale( &POSIX::LC_TIME, 'en_US.UTF-8' );
+
+use_ok 'Net::Domain::ExpireDate';
+
+diag '.com .net .org tests';
+is expdate_fmt( "\nRecord expires on 27-Apr-2011.\n" ), '2011-04-27';
+is expdate_fmt( "\nDomain expires: 24 Oct 2010\n" ), '2010-10-24';
+is expdate_fmt( "\nRecord expires on........: 03-Jun-2005 EST.\n" ), '2005-06-03';
+is expdate_fmt( "\nExpires on..............: 24-JAN-2003\n" ), '2003-01-24';
+is expdate_fmt( "\nExpiration Date: 02-Aug-2003 22:07:21\n" ), '2003-08-02';
+is expdate_fmt( "\nExpiration Date:03-Mar-2004 05:00:00 UTC\n" ), '2004-03-03';
+is expdate_fmt( "\nRecord expires on 2003-09-08\n" ), '2003-09-08';
+is expdate_fmt( "\nRecord expires:       2003-07-29 10:45:05 UTC\n" ), '2003-07-29';
+is expdate_fmt( "\nexpires:        2003-05-21 10:09:56\n" ), '2003-05-21';
+is expdate_fmt( "\nRecord expires on:       2010-04-07 00:00:00.0 ET\n" ), '2010-04-07';
+is expdate_fmt( "\nRecord expires on 2012-07-15 10:23:10.000\n" ), '2012-07-15';
+is expdate_fmt( "\nRecord expired on 2008/8/26\n" ), '2008-08-26';
+is expdate_fmt( "\nRecord expires:           2003-03-12 12:16:45\n" ), '2003-03-12';
+is expdate_fmt( "\nRecord expires on 2010-04-24 16:03:20+10\n" ), '2010-04-24';
+is expdate_fmt( "\nExpires on: 2003-11-05\n" ), '2003-11-05';
+is expdate_fmt( "\nDomain expires: 2007-01-20.\n" ), '2007-01-20';
+is expdate_fmt( "\nExpiry Date.......... 2009-06-16\n" ), '2009-06-16';
+is expdate_fmt( "\nExpire on................ 2002-11-05 16:42:41.000\n" ), '2002-11-05';
+is expdate_fmt( "\nValid Date     2010-11-02 05:21:35 EST\n" ), '2010-11-02';
+is expdate_fmt( "\nExpiration Date     : 2002-11-19 04:18:25-05\n" ), '2002-11-19';
+is expdate_fmt( "\nDate of expiration  : 2003-05-28 11:50:58\n" ), '2003-05-28';
+is expdate_fmt( "\nExpires on..............: 2006-07-24\n" ), '2006-07-24';
+is expdate_fmt( "\nexpires:        20030803\n" ), '2003-08-03';
+is expdate_fmt( "\nExpires on: 12-DEC-05\n" ), '2005-12-12';
+is expdate_fmt( "\nExpires on..............: Tue, Aug 04, 2009\n" ), '2009-08-04';
+is expdate_fmt( "\nExpires on..............: Oct  5 2002 12:00AM\n" ), '2002-10-05';
+
+is expdate_fmt( "\nRecord expires on December 05, 2004\n" ), '2004-12-05';
+
+is expdate_fmt( "\nRecord expires on.......: Oct  28, 2011\n" ), '2011-10-28';
+is expdate_fmt( "\nExpires on .............WED NOV 16 09:09:52 2011\n" ), '2011-11-16';
+is expdate_fmt( "\nExpires after:   Mon Jun  9 23:59:59 2003\n" ), '2003-06-09';
+is expdate_fmt( "\nRecord expires on 10-05-2003 11:21:25 AM\n" ), '2003-10-05';
+is expdate_fmt( "\nExpires on 10-09-2011\n" ), '2011-10-09';
+is expdate_fmt( "\nRecord Expires on 08-24-2011\n" ), '2011-08-24';
+is expdate_fmt( "\nExpiration: 6/3/2004\n" ), '2004-06-03';
+is expdate_fmt( "\nExpires on 11/26/2007 23:00:00\n" ), '2007-11-26';
+is expdate_fmt( "\nRecord expires on 2010-Apr-03\n" ), '2010-04-03';
+is expdate_fmt( "\nRecord expires on 2012-Apr-5.\n" ), '2012-04-05';
+is expdate_fmt( "\nExpires on..............: 2006-Jun-12\n" ), '2006-06-12';
+is expdate_fmt( "\nExpiration date: 09/21/03 13:45:09\n" ), '2003-09-21';
 # whois.bulkregister.com can give expiration date in different formats
-is( expdate_fmt("\nRecord expires on 2003-04-25\n"), '2003-04-25' );
-is( expdate_fmt("\nRecord will be expiring on date: 2003-04-25\n"), '2003-04-25' );
-is( expdate_fmt("\nRecord expiring on -  2003-04-25\n"), '2003-04-25' );
-is( expdate_fmt("\nRecord will expire on -  2003-04-25\n"), '2003-04-25' );
-is( expdate_fmt("\nRecord will be expiring on date: 2003-04-25\n"), '2003-04-25' );
+is expdate_fmt( "\nRecord expires on 2003-04-25\n" ), '2003-04-25';
+is expdate_fmt( "\nRecord will be expiring on date: 2003-04-25\n" ), '2003-04-25';
+is expdate_fmt( "\nRecord expiring on -  2003-04-25\n" ), '2003-04-25';
+is expdate_fmt( "\nRecord will expire on -  2003-04-25\n" ), '2003-04-25';
+is expdate_fmt( "\nRecord will be expiring on date: 2003-04-25\n" ), '2003-04-25';
+
+is expdate_fmt( "\nExpires : January 27 2019.\n" ), '2019-01-27';
+is expdate_fmt( "\nexpires:      September  5 2012\n" ), '2012-09-05';
+is expdate_fmt( "\nDomain Expiration Date:29-Apr-2013 17:53:03 UTC\n" ), '2013-04-29';
 
-is( expdate_fmt("\nExpires : January 27 2019.\n"), '2019-01-27' );
-is( expdate_fmt("\nexpires:      September  5 2012\n"), '2012-09-05' );
-is( expdate_fmt("\nDomain Expiration Date:29-Apr-2013 17:53:03 UTC\n"), '2013-04-29' );
+is expdate_fmt( "\nstatus:     OK-UNTIL 20130104013013\n" ), '2013-01-04';
+is expdate_fmt( "\nExpiry : 2017-01-25\n" ), '2017-01-25';
 
-is( expdate_fmt("\nstatus:     OK-UNTIL 20130104013013\n"), '2013-01-04' );
+diag '.ru tests';
+is expdate_fmt( "\nstate:   Delegated till 2003.10.01\nstate:   RIPN NCC check completed OK\n", 'ru' ), '2003-10-01';
+is expdate_fmt( "\ncreated:  2001.09.19\nreg-till: 2003.09.20\n", 'ru' ), '2003-09-20';
+is expdate_fmt( "\nstate:    REGISTERED, NOT DELEGATED\nfree-date:2002.10.03\n", 'ru' ), '2002-08-31';
 
-print ".ru tests\n";
-is( expdate_fmt("\nstate:   Delegated till 2003.10.01\nstate:   RIPN NCC check completed OK\n", 'ru'), '2003-10-01' );
-is( expdate_fmt("\ncreated:  2001.09.19\nreg-till: 2003.09.20\n", 'ru'), '2003-09-20' );
-is( expdate_fmt("\nstate:    REGISTERED, NOT DELEGATED\nfree-date:2002.10.03\n", 'ru'), '2002-08-31' );
+diag 'creation date tests';
 
-print "creation date tests\n";
+is credate_fmt( "\nDomain Registration Date:   Wed Mar 27 00:01:00 GMT 2002\n", 'biz' ), '2002-03-27';
+is credate_fmt( "\nRegistered:  Wed Jan 17 2001\n", 'biz' ), '2001-01-17';
+is credate_fmt( "\nRecord created on Feb 21 2001.\n", 'biz' ), '2001-02-21';
+is credate_fmt( "\nDomain created on 2002-10-29 03:54:36\n", 'biz' ), '2002-10-29';
 
-is( credate_fmt("\nDomain Registration Date:   Wed Mar 27 00:01:00 GMT 2002\n", 'biz'), '2002-03-27' );
-is( credate_fmt("\nRegistered:  Wed Jan 17 2001\n", 'biz'), '2001-01-17' );
-is( credate_fmt("\nRecord created on Feb 21 2001.\n", 'biz'), '2001-02-21' );
-is( credate_fmt("\nDomain created on 2002-10-29 03:54:36\n", 'biz'), '2002-10-29' );
+is credate_fmt( "\nCreated : September 10 1999.\n", 'ac' ), '1999-09-10';
+is credate_fmt( "\nDomain Create Date:29-Apr-2008 17:53:03 UTC\n" ), '2008-04-29';
 
-is( credate_fmt("\nCreated : September 10 1999.\n", 'ac'), '1999-09-10' );
-is( credate_fmt('\nDomain Create Date:29-Apr-2008 17:53:03 UTC\n'), '2008-04-29' );
+is credate_fmt( "\ncreated:    0-UANIC 20130104013013\n" ), '2013-01-04';
 
-is( credate_fmt("\ncreated:    0-UANIC 20130104013013\n"), '2013-01-04' );
+diag 'domdates tests';
 
-print "domdates tests\n";
+is join( ';', domdates_fmt( "\nCreation Date: 06-sep-2000\nExpiration Date: 06-sep-2005\n" ) ),
+    '2000-09-06;2005-09-06;';
 
-is( join( ';', domdates_fmt("\nCreation Date: 06-sep-2000\nExpiration Date: 06-sep-2005\n") ), '2000-09-06;2005-09-06;' );
-is( join( ';', domdates_fmt("\ncreated:    2001.09.19\npaid-till:  2005.09.20\n", 'ru') ), '2001-09-19;2005-09-20;' );
-is( join( ';', domdates_fmt("\nCreated on..............: Mon, Nov 12, 2007\n      Expires on..............: Tue, Mar 26, 2013\n") ), '2007-11-12;2013-03-26;', 'domdates_fmt' );
+is join( ';', domdates_fmt( "\ncreated:    2001.09.19\npaid-till:  2005.09.20\n", 'ru' ) ),
+    '2001-09-19;2005-09-20;';
+is join( ';', domdates_fmt( "\nCreated on..............: Mon, Nov 12, 2007
+Expires on..............: Tue, Mar 26, 2013\n" ) ),
+    '2007-11-12;2013-03-26;', 'domdates_fmt';
 
 # online tests
 
-print "The following tests requires internet connection and may fail if checked domains were renewed...\n";
+diag 'The following tests requires internet connection and may fail if checked domains were renewed...';
 
 $Net::Domain::ExpireDate::USE_REGISTRAR_SERVERS = 2;
 
-like( expire_date('microsoft.com', '%Y-%m-%d'), qr(202\d-05-0(2|3)) );
-like( expire_date('usa.biz', '%Y-%m-%d'), qr(20\d\d-03-26) );
-is( expire_date('nic.md', '%Y-%m-%d'), '2019-10-19' );
-like( expire_date('nic.us', '%Y-%m-%d'), qr(20\d\d-04-17) );
-#like( expire_date('orenet.co.uk', '%Y-%m-%d'), /2006-01-23/ );
-#is( expire_date('nic.jp', '%Y-%m-%d'), '2013-07-31' );
+like expire_date( 'microsoft.com', '%Y-%m-%d' ), qr{202\d-05-0(2|3)};
+like expire_date( 'usa.biz', '%Y-%m-%d '), qr{20\d\d-03-26};
+is expire_date( 'nic.md', '%Y-%m-%d' ), '2019-10-19';
+like expire_date( 'nic.us', '%Y-%m-%d' ), qr{20\d\d-04-17};
+
+is( ( domain_dates( 'nic.jp', '%Y-%m-%d' ) )[0], '2003-07-31' );
 
 $Net::Domain::ExpireDate::USE_REGISTRAR_SERVERS = 0;
-like( join( ';', domain_dates("godaddy.com", '%Y-%m-%d') ), qr(1999-03-02;202\d-11-01;) );
+like join( ';', domain_dates( 'godaddy.com', '%Y-%m-%d') ), qr{1999-03-02;202\d-11-01;};
 $Net::Domain::ExpireDate::USE_REGISTRAR_SERVERS = 2;
 
+like join( ';', domain_dates( 'reg.ru', '%Y-%m-%d' ) ), qr{2005-11-01;201\d-11-01;};
 
-like( join( ';', domain_dates("reg.ru", '%Y-%m-%d') ), qr(2005-11-01;201\d-11-01;) );
+like join( ';', domain_dates( 'ibm.com', '%Y-%m-%d' ) ), qr{1986-03-19;20\d\d-03-20;};
+like join( ';', domain_dates( 'intel.com', '%Y-%m-%d' ) ), qr{1986-03-25;20\d\d-03-26;};
 
-like( join( ';', domain_dates("ibm.com", '%Y-%m-%d') ), qr(1986-03-19;20\d\d-03-21;) );
-like( join( ';', domain_dates("intel.com", '%Y-%m-%d') ), qr(1986-03-25;20\d\d-03-26;) );
+done_testing();
\ No newline at end of file