Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 98809
Status: open
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: support more overloads in type constraints
MooseX::Types types support more overloads than native types, which violates the principle of least surprise. this works: use Moose::Util::TypeConstraints 'class_type'; use MooseX::Types::Moose 'HashRef'; my $type1 = HashRef | class_type('Foo'); this does not: my $type2 = $type1 | class_type('Bar'); It actually *appears* to work, but what you get in $type2 is a string created by the bitwise ORing of the stringification of the two input types. We don't find out until runtime that this is totally broken! It should be quite straightforward to overload '|' on Moose::Meta::TypeConstraint objects and create a ::Union from the inputs.
I have created a pull request for this, it's essentially just copying the code from the other module so that it works in the core Moose code. https://github.com/moose/Moose/pull/156 If there are any problems please say.