MooseX::Types::DateTimeXを入れてるときにコケた。
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/01_basic.t t/02_olson_abbreviations.t t/03_local_floating.t
t/01_basic.t ................ 12/?
# Failed test 'bad time zone'
# at t/01_basic.t line 89.
# Looks like you failed 1 test of 21.
t/01_basic.t ................ Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/21 subtests
t/02_olson_abbreviations.t .. ok
t/03_local_floating.t ....... ok
Test Summary Report
-------------------
t/01_basic.t (Wstat: 256 Tests: 21 Failed: 1)
Failed test: 16
Non-zero exit status: 1
Files=3, Tests=28, 5 wallclock secs ( 0.09 usr 0.01 sys + 5.34 cusr 0.17 csys = 5.61 CPU)
Result: FAIL
Failed 1/3 test programs. 1/28 subtests failed.
make: *** [test_dynamic] エラー 255
ECARROLL/MooseX-Types-DateTime-ButMaintained-0.08.tar.gz
/usr/bin/make test -- NOT OK
では、テストコードから該当箇所を抜粋。
{
{
package Bar;
use Moose;
has time_zone => (
isa => "DateTime::TimeZone",
is => "rw",
coerce => 1,
);
}
my $tz = Bar->new( time_zone => "Africa/Timbuktu" )->time_zone;
isa_ok( $tz, "DateTime::TimeZone", "coerced string into time zone object" );
like( $tz->name, qr/^Africa/, "correct time zone" );
dies_ok { Bar->new( time_zone => "Space/TheMoon" ) } "bad time zone";
}
coerceまわりがおかしいっぽい。
では、coerceまわりのロジックをチェック。
our %coercions = (
DateTime => [
from Num, via { 'DateTime'->from_epoch( epoch => $_ ) }
, from HashRef, via { 'DateTime'->new( %$_ ) }
, from Now, via { 'DateTime'->now }
]
, "DateTime::Duration" => [
from Num, via { DateTime::Duration->new( seconds => $_ ) }
, from HashRef, via { DateTime::Duration->new( %$_ ) }
]
, "DateTime::TimeZone" => [
from Str, via {
# No abbreviation - assumed if we don't have a '/'
if ( m,/|floating|local, ) {
return DateTime::TimeZone->new( name => $_ );
}
# Abbreviation - assumed if we do have a '/'
# returns a DateTime::TimeZone::OffsetOnly
else {
my $offset = Olson::Abbreviations->new({ tz_abbreviation => $_ })->get_offset;
return DateTime::TimeZone->new( name => $offset );
}
}
]
, "DateTime::Locale" => [
from Moose::Util::TypeConstraints::find_or_create_isa_type_constraint("Locale::Maketext")
, via { DateTime::Locale->load($_->language_tag) }
, from Str, via { DateTime::Locale->load($_) }
]
);
おかしくね、これ。おかしいよ。
だって、dieするわけないよ。そりゃあテスト通りませんよね...
どうしてこうなった!どうしてこうなった!
しょうがないので、force installしましたとさ。おしまい。
2009-09-14 追記0.09がリリース済みです。
無事にテストも通りましたよ!
good job!
Running make for E/EC/ECARROLL/MooseX-Types-DateTime-ButMaintained-0.09.tar.gz
Is already unwrapped into directory /home/azuma/.cpan/build/MooseX-Types-DateTime-ButMaintained-0.09
CPAN.pm: Going to build E/EC/ECARROLL/MooseX-Types-DateTime-ButMaintained-0.09.tar.gz
/usr/bin/perl "-Iinc" Makefile.PL --config= --installdeps=DateTime::TimeZone,0.96
Cannot determine perl version info from lib/MooseX/Types/DateTime/ButMaintained.pm
cp lib/MooseX/Types/DateTime/ButMaintained.pm blib/lib/MooseX/Types/DateTime/ButMaintained.pm
Manifying blib/man3/MooseX::Types::DateTime::ButMaintained.3pm
/usr/bin/make -- OK
Running make test
/usr/bin/perl "-Iinc" Makefile.PL --config= --installdeps=DateTime::TimeZone,0.96
Cannot determine perl version info from lib/MooseX/Types/DateTime/ButMaintained.pm
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/01_basic.t t/02_olson_abbreviations.t t/03_local_floating.t
t/01_basic.t ................ ok
t/02_olson_abbreviations.t .. ok
t/03_local_floating.t ....... ok
All tests successful.
Files=3, Tests=28, 3 wallclock secs ( 0.02 usr 0.01 sys + 2.23 cusr 0.08 csys = 2.34 CPU)
Result: PASS
/usr/bin/make test -- OK
Running make install
/usr/bin/perl "-Iinc" Makefile.PL --config= --installdeps=DateTime::TimeZone,0.96
Cannot determine perl version info from lib/MooseX/Types/DateTime/ButMaintained.pm
Installing /usr/local/share/perl/5.8.8/MooseX/Types/DateTime/ButMaintained.pm
Installing /usr/local/man/man3/MooseX::Types::DateTime::ButMaintained.3pm
Appending installation info to /usr/lib/perl/5.8/perllocal.pod
/usr/bin/make install -- OK