[Moose-commits] r7157 - in Mouse/trunk: . lib/Mouse/Util
t/800_shikabased
sartak at code2.0beta.co.uk
sartak at code2.0beta.co.uk
Mon Dec 22 03:32:37 GMT 2008
Author: sartak
Date: 2008-12-21 19:32:37 -0800 (Sun, 21 Dec 2008)
New Revision: 7157
Modified:
Mouse/trunk/
Mouse/trunk/lib/Mouse/Util/TypeConstraints.pm
Mouse/trunk/t/800_shikabased/002-coerce_multi_class.t
Log:
r77761 at onn: sartak | 2008-12-21 22:32:29 -0500
You can redefine types in the original package
Property changes on: Mouse/trunk
___________________________________________________________________
Name: svk:merge
- 08e7d58d-de06-4458-8c15-335e402ab116:/local/Mouse:77759
08e7d58d-de06-4458-8c15-335e402ab116:/local/Mouse-trunk:61565
3efe9002-19ed-0310-8735-a98156148065:/Mouse/branches/shika-based:6997
+ 08e7d58d-de06-4458-8c15-335e402ab116:/local/Mouse:77761
08e7d58d-de06-4458-8c15-335e402ab116:/local/Mouse-trunk:61565
3efe9002-19ed-0310-8735-a98156148065:/Mouse/branches/shika-based:6997
Modified: Mouse/trunk/lib/Mouse/Util/TypeConstraints.pm
===================================================================
--- Mouse/trunk/lib/Mouse/Util/TypeConstraints.pm 2008-12-22 03:27:52 UTC (rev 7156)
+++ Mouse/trunk/lib/Mouse/Util/TypeConstraints.pm 2008-12-22 03:32:37 UTC (rev 7157)
@@ -90,7 +90,7 @@
sub _type {
my $pkg = caller(0);
my($name, %conf) = @_;
- if (my $type = $TYPE{$name}) {
+ if ($TYPE{$name} && $TYPE_SOURCE{$name} ne $pkg) {
Carp::croak "The type constraint '$name' has already been created in $TYPE_SOURCE{$name} and cannot be created again in $pkg";
};
my $constraint = $conf{where} || do { $TYPE{delete $conf{as} || 'Any' } };
@@ -102,7 +102,7 @@
sub _subtype {
my $pkg = caller(0);
my($name, %conf) = @_;
- if (my $type = $TYPE{$name}) {
+ if ($TYPE{$name} && $TYPE_SOURCE{$name} ne $pkg) {
Carp::croak "The type constraint '$name' has already been created in $TYPE_SOURCE{$name} and cannot be created again in $pkg";
};
my $constraint = $conf{where} || do { $TYPE{delete $conf{as} || 'Any' } };
Modified: Mouse/trunk/t/800_shikabased/002-coerce_multi_class.t
===================================================================
--- Mouse/trunk/t/800_shikabased/002-coerce_multi_class.t 2008-12-22 03:27:52 UTC (rev 7156)
+++ Mouse/trunk/t/800_shikabased/002-coerce_multi_class.t 2008-12-22 03:32:37 UTC (rev 7157)
@@ -90,9 +90,11 @@
eval {
package Response;
- type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
+ type 'Headers' => where {
+ eval { $_->isa('Response::Headers') }
+ };
};
-like $@, qr/The type constraint 'Headers' has already been created in Response and cannot be created again in Response/;
+ok(!$@, "You can redefine types in their original package");
{
package Request;
More information about the Moose-commits
mailing list