Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 97684
Status: resolved
Priority: 0/
Queue: Type-Tiny

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

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



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
Do you have a pre-0.010 version of Type::Tiny::XS installed?
On Sun Aug 03 17:25:58 2014, TOBYINK wrote: Show quoted text
> Do you have a pre-0.010 version of Type::Tiny::XS installed?
Nope. But, I've drilled down deeper, and it's not Class::Enum at all, it's actually Mouse (used by Data::Validator, used by Class::Enum). New code, using Mouse instead of Class::Enum: #!perl use strict; use warnings; package Foo { use Mouse } use Type::Library -base, -declare => qw( Coord ExistingCoord ); use Type::Utils -all; use Types::Standard -all; declare ExistingCoord, as Str, where {}; declare Coord, as Str; use Type::Params qw[ validate ]; validate( [], slurpy Dict [ with => Optional [ExistingCoord] ] ); Results after installation of Type::Tiny 0.046 and Mouse 2.3.0 on a fresh install of perl 5.20.0 % perl bug.t Too few arguments for type constraint check functions at /home/dj/.perlbrew/libs/perl-5.20.0@tmp2/lib/perl5/Type/Tiny.pm line 358. Here are the distributions installed: http://www.cpan.org/authors/id/T/TO/TOBYINK/Type-Tiny-0.046.tar.gz http://www.cpan.org/authors/id/T/TO/TOBYINK/Exporter-Tiny-0.038.tar.gz http://www.cpan.org/authors/id/G/GF/GFUJI/Mouse-2.3.0.tar.gz http://www.cpan.org/authors/id/H/HI/HIDEAKIO/Module-Build-XSUtil-0.14.tar.gz http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4206.tar.gz http://www.cpan.org/authors/id/S/SY/SYOHEX/Devel-CheckCompiler-0.05.tar.gz http://www.cpan.org/authors/id/T/TO/TOKUHIROM/Test-Requires-0.08.tar.gz
On Mon Aug 04 11:40:52 2014, DJERIUS wrote: Show quoted text
> Results after installation of Type::Tiny 0.046 and Mouse 2.3.0 on a > fresh install of perl 5.20.0
I don't see the problem with Type::Tiny 0.047_5 or later. Diab
OK, when Type::Tiny::XS is not available and Mouse happens to already be loaded, Types::Standard uses some of Mouse's XS functions for a speed up. But there are some minor differences between Mouse and Type::Tiny::XS, in particular how they handle the sub being called with no arguments. Compare: perl -MType::Tiny::XS -E'Type::Tiny::XS::Int()' perl -MMouse -E'Mouse::Util::TypeConstraints::Int()' I've added your test case to the test suite, but I think it should already be fixed since Type::Tiny 0.047_05. And if you're using Type::Tiny 0.046 there are a couple of workarounds: install Type::Tiny::XS 0.010, or disable XS by setting the PERL_TYPE_TINY_XS environment variable to false.
On Mon Aug 04 15:51:51 2014, TOBYINK wrote: Show quoted text
> OK, when Type::Tiny::XS is not available and Mouse happens to already > be loaded, Types::Standard uses some of Mouse's XS functions for a > speed up. But there are some minor differences between Mouse and > Type::Tiny::XS, in particular how they handle the sub being called > with no arguments. > > Compare: > > perl -MType::Tiny::XS -E'Type::Tiny::XS::Int()' > perl -MMouse -E'Mouse::Util::TypeConstraints::Int()' > > I've added your test case to the test suite, but I think it should > already be fixed since Type::Tiny 0.047_05. > > And if you're using Type::Tiny 0.046 there are a couple of > workarounds: install Type::Tiny::XS 0.010, or disable XS by setting > the PERL_TYPE_TINY_XS environment variable to false.
Many thanks. That does the trick. Diab
Type-Tiny-1.000000 has been released, mostly resolving this.