From: Daisuke Maki Date: Sat, 7 Mar 2009 09:06:57 +0000 (+0000) Subject: properly commit the newly created parameterized type to the registry (cache!) X-Git-Tag: 0.19~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1f7ac337dbaf78702b2a316e9b64b9cea8fd7608;p=gitmo%2FMouse.git properly commit the newly created parameterized type to the registry (cache!) --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 4d312da..42b1d39 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -191,10 +191,10 @@ sub generate_handles { return \%method_map; } -our $optimized_constraints; +my $optimized_constraints; sub _build_type_constraint { my $spec = shift; - local $optimized_constraints ||= Mouse::Util::TypeConstraints->optimized_constraints; + $optimized_constraints ||= Mouse::Util::TypeConstraints->optimized_constraints; my $code; if ($spec =~ /^([^\[]+)\[(.+)\]$/) { # parameterized @@ -233,6 +233,7 @@ sub _build_type_constraint { } else { Carp::confess("Support for parameterized types other than ArrayRef or HashRef is not implemented yet"); } + $optimized_constraints->{$spec} = $code; } else { $code = $optimized_constraints->{ $spec }; if (! $code) {