Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 29269
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: stevan.little [...] gmail.com
Requestors: polettix [...] cpan.org
Cc:
AdminCc:

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



Subject: Type constraints check behaviour - changed thrown message?
Hi, after installing Moose 0.25 my type constraint checks suddenly turned into some rant against overload.pm. Am I using all this badly? Here follows an example (also attached): package ClassA; use strict; use warnings; use Moose; use Moose::Util::TypeConstraints; has attribute => ( is => 'rw', required => 1, isa => subtype 'Int' => where { my $value = shift; return $value > 0 && $value <= 255; }, ); package main; use Test::More 'no_plan'; use Test::Exception; lives_ok { ClassA->new(attribute => 3) } 'constructor with good value'; throws_ok { ClassA->new(attribute => -3) } qr/Attribute .* does not pass the type constraint/, 'constructor with bad value'; __END__ poletti@PolettiX:~/sviluppo/perl/moose$ perl test03.pl ok 1 - constructor with good value not ok 2 - constructor with bad value # Failed test 'constructor with bad value' # at test03.pl line 22. # expecting: Regexp ((?-xism:Attribute .* does not pass the type constraint)) # found: Can't call method "can" without a package or object reference at /opt/perl/lib/5.8.8/overload.pm line 54. 1..2 # Looks like you failed 1 test of 2.
Subject: test03.pl
package ClassA; use strict; use warnings; use Moose; use Moose::Util::TypeConstraints; has attribute => ( is => 'rw', required => 1, isa => subtype 'Int' => where { my $value = shift; return $value > 0 && $value <= 255; }, ); package main; use Test::More 'no_plan'; use Test::Exception; lives_ok { ClassA->new(attribute => 3) } 'constructor with good value'; throws_ok { ClassA->new(attribute => -3) } qr/Attribute .* does not pass the type constraint/, 'constructor with bad value'; __END__
This has been fixed in the svn HEAD, and will be fixed in the next release (0.26) planned for sometime later this week. Thanks, - Stevan