From: Yuval Kogman Date: Thu, 14 Aug 2008 15:05:37 +0000 (+0000) Subject: make sure get_method_map always returns a map (might be a dumb fudge) X-Git-Tag: 0_64_01~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6005e34cc9c67a12593490d02d2cdf478385dcc8;p=gitmo%2FClass-MOP.git make sure get_method_map always returns a map (might be a dumb fudge) --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 2ac726e..e8cf77f 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -314,12 +314,12 @@ sub get_method_map { my $current = Class::MOP::check_package_cache_flag($self->name); if (defined $self->{'_package_cache_flag'} && $self->{'_package_cache_flag'} == $current) { - return $self->{'methods'}; + return $self->{'methods'} ||= {}; } $self->{_package_cache_flag} = $current; - my $map = $self->{'methods'}; + my $map = $self->{'methods'} ||= {}; my $class_name = $self->name; my $method_metaclass = $self->method_metaclass;