1MakeMethods::Emulator::USsienrglCeotnotnr(i3b)uted PerlMDaokceuMmeetnhtoadtsi:o:nEmulator::Singleton(3)
2
3
4
6 Class::MakeMethods::Emulator::Singleton - Emulate Class::Singleton
7
9 use Class::MakeMethods::Emulator::Singleton;
10
11 # returns a new instance
12 my $one = Class::MakeMethods::Emulator::Singleton->instance();
13
14 # returns same instance
15 my $two = Class::MakeMethods::Emulator::Singleton->instance();
16
18 This module emulates the functionality of Class::Singleton, using
19 Class::MakeMethods to generate similar methods.
20
21 You may use it directly, as shown in the SYNOPSIS above,
22
23 Furthermore, you may call "use Class::MakeMethods::Emulator::Singleton
24 '-take_namespace';" to alias the Class::Singleton namespace to this
25 package, and subsequent calls to the original package will be
26 transparently handled by this emulator. To remove the emulation
27 aliasing, call "use Class::MakeMethods::Emulator::Singleton
28 '-release_namespace'".
29
30 Caution: This affects all subsequent uses of Class::Singleton in your
31 program, including those in other modules, and might cause unexpected
32 effects.
33
35 A Singleton describes an object class that can have only one instance
36 in any system. An example of a Singleton might be a print spooler or
37 system registry. This module implements a Singleton class from which
38 other classes can be derived. By itself, the Class::Singleton module
39 does very little other than manage the instantiation of a single
40 object. In deriving a class from Class::Singleton, your module will
41 inherit the Singleton instantiation method and can implement whatever
42 specific functionality is required.
43
45 See Class::MakeMethods for general information about this distribution.
46
47 See Class::MakeMethods::Emulator for more about this family of
48 subclasses.
49
50 See Class::Singleton for documentation of the original module.
51
52 For a description and discussion of the Singleton class, see "Design
53 Patterns", Gamma et al, Addison-Wesley, 1995, ISBN 0-201-63361-2.
54
55 See "new" in Class::MakeMethods::Hash and "instance" in
56 Class::MakeMethods::ClassVar for documentation of the created methods.
57
58
59
60perl v5.36.0 2023-01-20MakeMethods::Emulator::Singleton(3)