Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Creating 'universal' instances of objects?

by bm (Hermit)
on Aug 04, 2003 at 15:27 UTC ( #280704=note: print w/replies, xml ) Need Help??


in reply to Creating 'universal' instances of objects?

Sounds to me that Class::Singleton is exactly what you are after.

Deriving from that class will ensure that only one instance of your class will be returned:

package Grok; use vars qw(@ISA); @ISA = qw(Class::Singleton); package Main; my $one = Grok->instance(); # returns a new instance my $two = Grok->instance(); # returns same instance
Hope this helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://280704]
help
Chatterbox?
[hippo]: It's always good to start the day with a laugh and Re^2: Subroutine processes only one file in the directory has genuinely made me do so. Well done, sridhar56!
[Discipulus]: :=)
[johngg]: hippo Yes, that's a cracker :-D
[Discipulus]: hippo take a look at Re^2: Cookie->fetch problem

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (11)
As of 2017-05-26 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?