From: gfx Date: Wed, 7 Oct 2009 11:58:44 +0000 (+0900) Subject: Fix an accessor generator to accept role application to instance X-Git-Tag: 0.37_03~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c3797828b5fae171b01dbb08a9a752c610d8a7bf;p=gitmo%2FMouse.git Fix an accessor generator to accept role application to instance --- diff --git a/lib/Mouse/Meta/Method/Accessor.pm b/lib/Mouse/Meta/Method/Accessor.pm index c85f72f..d073cb5 100755 --- a/lib/Mouse/Meta/Method/Accessor.pm +++ b/lib/Mouse/Meta/Method/Accessor.pm @@ -74,7 +74,8 @@ sub _generate_accessor{ $class->throw_error("Unknown accessor type '$type'"); } - if ($attribute->is_lazy) { + # XXX: an anon class can be a runtime created class + if ($attribute->is_lazy || $class->is_anon_class) { my $value; if (defined $builder){ @@ -108,7 +109,7 @@ sub _generate_accessor{ $accessor .= "return $slot;\n}\n"; - #print $accessor, "\n"; + #print "# class ", $class->name, "\n", $accessor, "\n"; my $code; my $e = do{ local $@;