# # This software is Copyright 2005 by Elsevier Inc. You may use it # under the terms of the license at http://perl.plover.com/hop/LICENSE.txt . # ### ### memoize_method ### ## Chapter 3 section 8.1 sub memoize_method { my ($method, $key) = @_; return sub { my $self = shift; return $self->{$key} if exists $self->{$key}; return $self->{$key} = $method->($self, @_); }; }