Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

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

Owner: Nobody in particular
Requestors: ether [...]

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

Subject: support more overloads in type constraints
Download (untitled) / with headers
text/plain 776b
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.
Download (untitled) / with headers
text/plain 222b
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. If there are any problems please say.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to