It sounds like you might want Data::Thunk.
In reply to Re: Automatic vivification of an object by tobyink in thread Automatic vivification of an object by bounsy