From: Shawn M Moore Date: Sun, 2 Nov 2008 16:31:25 +0000 (+0000) Subject: Inline the key in predicate and clearer too X-Git-Tag: 0.19~157 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=d10fd51092531b4ad3b3ecc0fe838f741094c69b Inline the key in predicate and clearer too --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 21e98e7..6530166 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -134,9 +134,9 @@ sub generate_accessor { sub generate_predicate { my $attribute = shift; - my $key = $attribute->name; + my $key = $attribute->inlined_name; - my $predicate = 'sub { exists($_[0]->{$key}) }'; + my $predicate = 'sub { exists($_[0]->{'.$key.'}) }'; my $sub = eval $predicate; confess $@ if $@; @@ -145,9 +145,9 @@ sub generate_predicate { sub generate_clearer { my $attribute = shift; - my $key = $attribute->name; + my $key = $attribute->inlined_name; - my $clearer = 'sub { delete($_[0]->{$key}) }'; + my $clearer = 'sub { delete($_[0]->{'.$key.'}) }'; my $sub = eval $clearer; confess $@ if $@;