Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
A singleton is even easier to do in Perl. You don't even need a reference. Because in Perl you can say
you only need to return a string with the package name in a singleton's constructor.
Here we also avoid the need to check whether the object is initialized by using a glob to replace &new. None of the further calls to the constructor will execute its initial code. All of your methods can just ignore the $self too, since there's a single instance which stores its data in file lexicals. Makeshifts last the longest. In reply to Re^2: single instance shared with module
by Aristotle
|
|