in reply to Re^2: Caching a default instance to avoid initializing it every time (with Moo)
in thread Caching a default instance to avoid initializing it every time (with Moo)
You'd still have to write a wrapper if you want a single interface to sometimes provide a new instance, sometimes the singleton. But I like that this interface leaves the choice to the caller, you can either have a new instance, regardless of input, or the singleton when you know it can work.
|
---|
In Section
Seekers of Perl Wisdom