MakeMe...gleton(3pm)

πŸ“¦
version 1.01 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay so bestie, welcome to the MakeMe...gleton(3pm) page πŸ’… β€” manual name folded in near the top, from the User Contributed Perl Documentation section. We're doing Perl singleton lore today. πŸ¦‹

Class::MakeMethods::Emulator::Singleton β€” literally here to emulate Class::Singleton. That's the name, no cap. πŸŽ€


✨ SYNOPSIS ✨

Like, the whole point is: call it once, get an instance; call it again, get the same instance. The code is doing main character energy:

use Class::MakeMethods::Emulator::Singleton;

# returns a new instance
my $one = Class::MakeMethods::Emulator::Singleton->instance();

# returns same instance
my $two = Class::MakeMethods::Emulator::Singleton->instance();

So $one gets the new instance, and $two gets the same instance β€” that's the singleton slay. πŸ’–


✨ COMPATIBILITY ✨

okay so this module is emulating the functionality of Class::Singleton, using Class::MakeMethods to generate similar methods. Iconic, fr fr. You may use it directly, exactly like the SYNOPSIS above shows. ✨

You may also call:

use Class::MakeMethods::Emulator::Singleton '-take_namespace';

That aliases the Class::Singleton namespace to this package, and subsequent calls to the original package will be transparently handled by this emulator. iykyk. To remove the emulation aliasing, call:

use Class::MakeMethods::Emulator::Singleton '-release_namespace';
Caution: this affects all subsequent uses of Class::Singleton in your program, including those in other modules, and might cause unexpected effects. So, like, be aware, bestie β€” this is highkey a whole global-namespace vibe shift. 😭

✨ DESCRIPTION ✨

A Singleton describes an object class that can have only one instance in any system. Literally one. An example of a Singleton might be a print spooler or a system registry. πŸ–¨οΈ

This module implements a Singleton class from which other classes can be derived. By itself, the Class::Singleton module does very little other than manage the instantiation of a single object. ngl, that's its whole thing, and honestly, same. In deriving a class from Class::Singleton, your module will inherit the Singleton instantiation method and can implement whatever specific functionality is required. Periodt. πŸ’…


✨ SEE ALSO ✨

The reference section is serving, and yes, every single one is here β€” vibe check:

  • See Class::MakeMethods for general information about this distribution. 🌈
  • See Class::MakeMethods::Emulator for more about this family of subclasses. πŸ¦‹
  • See Class::Singleton for documentation of the original module. πŸ“š
  • For a description and discussion of the Singleton class, see "Design Patterns", Gamma et al, Addison-Wesley, 1995, ISBN 0-201-63361-2. πŸ‘‘
  • See "new" in Class::MakeMethods::Hash and "instance" in Class::MakeMethods::ClassVar for documentation of the created methods. πŸ”₯

okay that's the page, bestie. This manual situation is from perl v5.36.0, dated 2022-10-13, and the page is MakeMe...gleton(3pm) β€” mwah, bye! πŸ’–βœ¨

πŸ“¦ where this page comes from