Subject: | cannot get .JP information |
Net::Domain::ExpireDate 0.95 cannot get .JP information.
I made the patch and the test case.
Please check it.
--- ExpireDate.pm 2009-04-08 17:23:06.000000000 +0900
+++ ExpireDate.pm.new 2009-06-03 20:28:30.000000000 +0900
@@ -124,6 +124,9 @@
if ($tld eq 'ru' || $tld eq 'su') {
return (dates_int_ru( $whois ));
} else { # 'com', 'net', 'org', 'biz', 'info', 'us', 'uk', 'cc'
+ if ( $tld eq 'jp' ) {
+ eval {$whois = Encode::encode('iso-2022-jp', $whois) if Encode::is_utf8($whois);};
+ }
my $expdate = $flags & FLG_EXPDATE ? expdate_int_cno( $whois ) : undef;
my $credate = $flags & FLG_CREDATE ? credate_int_cno( $whois ) : undef;
return ($credate, $expdate);
@@ -276,6 +279,8 @@
# [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})|s) {
$rulenum = 7.4; $Y = $1; $m = $2; $d = $3;
+ } elsif ($whois =~
m|\[\x1b\x24\x42\x3e\x75\x42\x56\x1b\x28\x42\]\s+.*\s+\((\d{4})/(\d{2})/(\d{2})|s) {
+ $rulenum = 7.4; $Y = $1; $m = $2; $d = $3;
}
unless ($rulenum) {
--- 01.t 2009-04-08 17:23:06.000000000 +0900
+++ 01.t.new 2009-06-03 21:51:39.000000000 +0900
@@ -4,7 +4,7 @@
use lib qw(.);
use Test::More;
use Data::Dumper;
-BEGIN { plan tests => 63 };
+BEGIN { plan tests => 66 };
use Net::Domain::ExpireDate;
@@ -91,7 +91,9 @@
like( expire_date('nic.info', '%Y-%m-%d'), qr(201\d-07-27) );
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/ );
-#like( expire_date('google.jp', '%Y-%m-%d'), /2007-05-31/ );
+like( expire_date('google.jp', '%Y-%m-%d'), qr(20\d\d-05-31) );
+like( expire_date('google.co.jp', '%Y-%m-%d'), qr(20\d\d-03-31) );
+like( expire_date('google.ne.jp', '%Y-%m-%d'), qr(20\d\d-09-30) );
like( join( ';', domain_dates("godaddy.com", '%Y-%m-%d') ), qr(1999-03-02;201\d-03-02;)
);
like( join( ';', domain_dates("reg.ru", '%Y-%m-%d') ), qr(2005-11-01;200\d-11-01;) );