more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First, Perl doesn't distinguish between names like "new" and "getInstance", so there's no language reason to prefer one.
If your client code has a design reason to know it's dealing with a singleton, you might have a stylistic incentive to use different names, otherwise, make it transparent. The most elegant way I know of applying singletonhood to a class (if you don't mind introducing new tech) is with the Aspect module. All your code remains the same; you just say
at the top of your class, and that's it. In reply to Re: Singletons and Inheritance
by gaal
|
|