Subject: | Strange breakage with Class::Enum |
Using Class::Enum before using Type::Tiny messes up Type::Tiny.
Here's test code and output:
#!perl
use strict;
use warnings;
use Class::Enum 'AnEnum';
use Type::Library
-base,
-declare => qw(
Coord
ExistingCoord
);
use Type::Utils -all;
use Types::Standard -all;
declare Coord,
as Str;
declare ExistingCoord,
as Str,
where {};
use Type::Params qw[ validate ];
validate(
[],
slurpy Dict [
with => Optional [ExistingCoord] ] );
If you run this (Perl 5.16.3, Type::Tiny 0.046, Class::Enum 0.05), you get:
% perl bug.t
Too few arguments for type constraint check functions at [..]/Type/Tiny.pm line 358.
which is wrong.
But, if you
a) comment out the use Class::Enum; or
b) move the 'use Types::Standard' line before using Class::Enum; or
c) change the validation spec to use Coord instead of ExistingCoord (!);
it works.
Thanks,
Diab