> This being Perl, the global variable $_instance is just auto-vivified the first time it > gets assigned to by instance().
AHH !! That was the missing link !! Thank you, Thank you Thank ou Feeling less stupid.... Andy > -----Original Message----- > From: Perrin Harkins [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 30, 2002 11:50 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [Templates] OT: Class::Singleton > > > > How the heck does Class::Singleton do it's voodoo ?? I > understand that the > > instance() method looks for a reference to the _instance variable in the > > proper package. If it is there, it just returns it, otherwise it calls > > _new_instance to create an object of the proper class. BUT, > where does the > > _instance variable ever get created within the proper package namespace > ??? > > It sounds like you understand it just fine. The name of the package (which is the first arg to > instance() when called as a class method) is prepended to the $_instance > variable name. > > - Perrin
