Subject: | Package is not visible when Moose use DateTime|Undef union |
Hi
This is weird bug and I'm not sure if it belongs here or in Moose module, however DateTime
is the only module causing such problem.
When DateTime is used in Moose type checking it works fine:
$ perl -e 'use DateTime; package A; use Moose; has "foo" => ("is" => "ro", "isa" =>
"DateTime"); print "alive\n"'
alive
But when combining with Undef is somehow stops seeing DateTime definition:
$ perl -e 'use DateTime; package A; use Moose; has "foo" => ("is" => "ro", "isa" =>
"DateTime|Undef"); print "alive\n"'
Could not locate type constraint (DateTime) for the union at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Util/TypeConstraints.pm line 89
Moose::Util::TypeConstraints::create_type_constraint_union('DateTime|Undef') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Util/TypeConstraints.pm line 218
Moose::Util::TypeConstraints::find_or_parse_type_constraint('DateTime|Undef') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Util/TypeConstraints.pm line 204
Moose::Util::TypeConstraints::find_or_create_isa_type_constraint('DateTime|Undef')
called at /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Meta/Attribute.pm line 325
Moose::Meta::Attribute::_process_isa_option('Moose::Meta::Attribute', 'foo',
'HASH(0x7fb208b26070)') called at /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Meta/Attribute.pm line 252
Moose::Meta::Attribute::_process_options('Moose::Meta::Attribute', 'foo',
'HASH(0x7fb208b26070)') called at /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Meta/Attribute.pm line 57
Moose::Meta::Attribute::new('Moose::Meta::Attribute', 'foo', 'isa', 'DateTime|Undef',
'definition_context', 'HASH(0x7fb208b6ac88)', 'is', 'ro') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level/Moose/Meta/Attribute.pm line
83
Moose::Meta::Attribute::interpolate_class_and_new('Moose::Meta::Attribute', 'foo', 'isa',
'DateTime|Undef', 'definition_context', 'HASH(0x7fb208b6ac88)', 'is', 'ro') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level/Moose/Meta/Class.pm line 438
Moose::Meta::Class::_process_new_attribute('Moose::Meta::Class=HASH(0x7fb208c70eb0)',
'foo', 'isa', 'DateTime|Undef', 'definition_context', 'HASH(0x7fb208b6ac88)', 'is', 'ro') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level/Moose/Meta/Class.pm line 431
Moose::Meta::Class::_process_attribute('Moose::Meta::Class=HASH(0x7fb208c70eb0)',
'foo', 'isa', 'DateTime|Undef', 'definition_context', 'HASH(0x7fb208b6ac88)', 'is', 'ro') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level/Moose/Meta/Class.pm line 300
Moose::Meta::Class::add_attribute('Moose::Meta::Class=HASH(0x7fb208c70eb0)', 'foo',
'isa', 'DateTime|Undef', 'definition_context', 'HASH(0x7fb208b6ac88)', 'is', 'ro') called at
/opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-2level/Moose.pm line 70
Moose::has('Moose::Meta::Class=HASH(0x7fb208c70eb0)', 'foo', 'is', 'ro', 'isa',
'DateTime|Undef') called at /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-multi-
2level/Moose/Exporter.pm line 359
Moose::has('foo', 'is', 'ro', 'isa', 'DateTime|Undef') called at -e line 1