2012-03-07 4 views
3

Perl用のDateTimeをインストールすると、次のエラーが発生し、失敗します。Perl DateTimeのインストール

# Failed test 'Make sure we can add 50 years worth of years in America/New_York time zone' 
# at t/30future-tz.t line 45. 
Use of uninitialized value in numeric ge (>=) at /home/bensley/.cpan/build/DateTime-0.72/blib/lib/DateTime.pm line 138. 

# Failed test 'Make sure we can add 50 years worth of days in America/Chicago time zone' 
# at t/30future-tz.t line 45. 
Use of uninitialized value in numeric ge (>=) at /home/bensley/.cpan/build/DateTime-0.72/blib/lib/DateTime.pm line 138. 

# Failed test 'Make sure we can add 50 years worth of minutes in America/Denver time zone' 
# at t/30future-tz.t line 45. 
Use of uninitialized value in numeric ge (>=) at /home/bensley/.cpan/build/DateTime-0.72/blib/lib/DateTime.pm line 138. 

# Failed test 'Make sure we can add 50 years worth of seconds in America/Los_Angeles time zone' 
# at t/30future-tz.t line 45. 
Use of uninitialized value in numeric ge (>=) at /home/bensley/.cpan/build/DateTime-0.72/blib/lib/DateTime.pm line 138. 

# Failed test 'Make sure we can add 50 years worth of nanoseconds in America/North_Dakota/Center time zone' 
# at t/30future-tz.t line 45. 

フル出力がかなり長いので、私はそれをここに貼り付けてきている:私はPerlモジュールに新たなんだとthusly、完全に失わhttp://pastebin.com/raw.php?i=JiJeH4ij

。何が起きてる?

UPDATE:

$ perl --version 

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi 

$ lsb_release -a 
No LSB modules are available. 
Distributor ID: Ubuntu 
Description: Ubuntu 8.04.4 LTS 
Release: 8.04 
Codename: hardy 
+0

使用している32 bitまたは64-bit Perl?どのPerlのバージョンを使用していますか?どのプラットフォームですか? –

+0

申し訳ありません、私の間違い、私はポストを更新しました。ナッジに感謝します! – jwbensley

+0

Perl ...と32ビットの最新リリースではありません。うーん...私はMac OS X 10.7.3上で64ビットのPerl 5.14.1を持っており、問題なくDateTime 0.72のビルドとテストを行っただけです。私は32ビットのPerl 5.10.0を持っています。モジュールをアップグレードする必要があります(最後に使用してからしばらくして、ビルドのサポートは古すぎます)。 –

答えて

9

これはおそらくあなたの問題です。 CPANクライアントの

Package seems to come without Makefile.PL. 
    (The test -f "/home/bensley/.cpan/build/DateTime-0.72/Makefile.PL" returned false.) 
    Writing one on our own (setting NAME to DateTime) 

あなたのコピーは、それが「新しい」(それによって、私は10歳を意味する)Build.PLモジュールのビルドを認識し、メカニズムをインストールしていない古くなっています。代わりにCPANは独自のインストーラを書いて、とにかくインストールを試みました。これは多くのPerlモジュールで動作しますが、おそらくDateTimeで必要とされる微妙な部分は見逃していました。

CPANクライアントをアップグレードします.CPANクライアントでアップグレードしてから、もう一度やり直してください。

+0

私は正しくCPANを更新したと私は信じて、私の現在のバージョンは1.9800です。私は正しいバージョン番号を見ているように聞こえますか? :)まだDateTimeをインストールすることはできません。 – jwbensley

+0

私はPerlを5.14にアップデートしました。DateTimeは0.72にインストールされています。私はまだ "DateTime> = 0.44 ... MISSING"についてのエラーを投げて、私のアプリケーションをインストールすることはできませんが、それは別の問題です。 "cpan DateTime"を実行すると、私は更新が0.72であることが確認されます。ありがとう:) – jwbensley

+0

@javanoあなたのアプリケーションは、perlの異なるコピー、またはコマンドライン上のものとは異なる 'PERL5LIB'設定を使用している可能性が高く、インストールされたライブラリを見ることができません。私はそれを別の質問として尋ねるでしょう。 – Schwern

2

スレッドnecromancyのお詫び。

CentOS 5.7、perl 5.8.8(perl-5.8.8-38.el5)に同じ問題がありました。 Devel :: Peek Dump()を使用して、私のブラウザウィンドウがクラッシュしました。

m/^ \ d + $/regexはpPOK(POKp?と同じ)フラグをオフにし、$ _ [0]が文字列と数値の両方のコンテキストでundefになったと言えます。私は他のOSで再現できないので、このバージョンのperlのバグだと思う。

のperlの更新は本当に現時点ではオプションではありませんように私は、この問題を回避するために、DateTime.pmを変えてしまった:

129c129 
<     sub { $_[0] =~ /^\d+$/ && $_[0] >= 1 && $_[0] <= 12 } 
--- 
>     sub { $_[0] && $_[0] !~ /\D/ && $_[0] >= 1 && $_[0] <= 12 } 
137c137 
<     sub { $_[0] =~ m/^\d+$/ && $_[0] >=1 && $_[0] <= 31 } 
--- 
>     sub { $_[0] && $_[0] !~ m/\D/ && $_[0] >=1 && $_[0] <= 31 } 

編集:私のバッファ内のDevel ::かいま見のものを見つけました。

# generated by having this inside the validation sub 
warn("before re (" . $_[0]. ")"); 
Dump($_[0]) 
return unless $_[0] =~ s/^\d+$/; 
warn("after re (" . $_[0] . ")"); 
Dump($_[0]); 

出力:変数のコピーを使用して

before re (1) at blib/lib/DateTime.pm line 139. 
SV = PVMG(0x8104d40) at 0x827dc24 
REFCNT = 7 
FLAGS = (GMG,SMG,READONLY,pPOK) 
IV = 0 
NV = 0 
PV = 0x8502610 "1"\0 
CUR = 1 
LEN = 4 
MAGIC = 0x82d9a30 
    MG_VIRTUAL = &PL_vtbl_sv 
    MG_TYPE = PERL_MAGIC_sv(\0) 
    MG_OBJ = 0x827dc18 
    MG_LEN = 1 
    MG_PTR = 0x82d9a50 "3" 
Use of uninitialized value in concatenation (.) or string at blib/lib/DateTime.pm line 142. 
after re() at blib/lib/DateTime.pm line 142. 
SV = PVMG(0x8104d40) at 0x827dc24 
REFCNT = 7 
FLAGS = (GMG,SMG,READONLY) 
IV = 0 
NV = 0 
PV = 0x8502610 "1"\0 
CUR = 1 
LEN = 4 
MAGIC = 0x82d9a30 
    MG_VIRTUAL = &PL_vtbl_sv 
    MG_TYPE = PERL_MAGIC_sv(\0) 
    MG_OBJ = 0x827dc18 
    MG_LEN = 1 
    MG_PTR = 0x82d9a50 "3" 
Use of uninitialized value in numeric ge (>=) at blib/lib/DateTime.pm line 144. 
not ok 1 - Make sure we can add 50 years worth of years in America/New_York time zone 
# Failed test 'Make sure we can add 50 years worth of years in America/New_York time zone' 
# at t/30future-tz.t line 45. 
2

が問題(perlの5.8.8、CentOSの5)の周りに働いていた...

diff -ur DateTime-0.76/lib/DateTime.pm DateTime-0.76--perl-5.8.8.fix/lib/DateTime.pm 
--- DateTime-0.76/lib/DateTime.pm.orig  2012-07-01 11:55:52.000000000 -1000 
+++ DateTime-0.76/lib/DateTime.pm 2013-03-25 11:10:26.209878929 -1000 
@@ -115,10 +115,17 @@ 
__PACKAGE__->DefaultLocale('en_US'); 

my $BasicValidate = { 
+ 
+# XXX Mar 25 2013. Test t/30future-tz.t fails in versions 0.7[68], with perl 
+# 5.8.8, with "Use of uninitialized value in numeric ge (>=) at [...] line 137." 
+# See http://stackoverflow.com/questions/9601516/installing-perl-datetime for 
+# other details. Apparently making a copy overcomes the problem of value 
+# changing to undef (discovered by trial-and-error). 
+ 
    year => { 
     type  => SCALAR, 
     callbacks => { 
-   'is an integer' => sub { $_[0] =~ /^-?\d+$/ } 
+   'is an integer' => sub { my $i = $_[0]; $i =~ /^-?\d+$/ } 
     }, 
    }, 
    month => { 
@@ -126,7 +133,7 @@ 
     default => 1, 
     callbacks => { 
      'an integer between 1 and 12' => 
-    sub { $_[0] =~ /^\d+$/ && $_[0] >= 1 && $_[0] <= 12 } 
+    sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 1 && $i <= 12 } 
     }, 
    }, 
    day => { 
@@ -134,7 +141,7 @@ 
     default => 1, 
     callbacks => { 
      'an integer which is a possible valid day of month' => 
-    sub { $_[0] =~ /^\d+$/ && $_[0] >= 1 && $_[0] <= 31 } 
+    sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 1 && $i <= 31 } 
     }, 
    }, 
    hour => { 
@@ -142,7 +149,7 @@ 
     default => 0, 
     callbacks => { 
      'an integer between 0 and 23' => 
-    sub { $_[0] =~ /^\d+$/ && $_[0] >= 0 && $_[0] <= 23 }, 
+    sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 0 && $i <= 23 }, 
     }, 
    }, 
    minute => { 
@@ -150,7 +157,7 @@ 
     default => 0, 
     callbacks => { 
      'an integer between 0 and 59' => 
-    sub { $_[0] =~ /^\d+$/ && $_[0] >= 0 && $_[0] <= 59 }, 
+    sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 0 && $i <= 59 }, 
     }, 
    }, 
    second => { 
@@ -158,14 +165,14 @@ 
     default => 0, 
     callbacks => { 
      'an integer between 0 and 61' => 
-    sub { $_[0] =~ /^\d+$/ && $_[0] >= 0 && $_[0] <= 61 }, 
+    sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 0 && $i <= 61 }, 
     }, 
    }, 
    nanosecond => { 
     type  => SCALAR, 
     default => 0, 
     callbacks => { 
-   'a positive integer' => sub { $_[0] =~ /^\d+$/ && $_[0] >= 0 }, 
+   'a positive integer' => sub { my $i = $_[0]; $i =~ /^\d+$/ && $i >= 0 }, 
     } 
    }, 
    locale => { 
関連する問題