This is the kind of thing that Class::DBI does for me automatically, but that doesn't help you since this is someone else's code. After taking a brief glance at Class::LazyObject though, I think that it would do what you want without additional effort. There is also Class::Proxy and Class::Proxy::Lite, but the docs for those are a bit harder to follow.