Transparently speed up perl functions by caching return values