1MakeMethods::Template::UCslearssCIonnhterriibtu(t3e)d PeMralkeDMoectuhmoednst:a:tTieomnplate::ClassInherit(3)
2
3
4
6 Class::MakeMethods::Template::ClassInherit - Overridable class data
7
9 package MyClass;
10
11 use Class::MakeMethods( 'Template::ClassInherit:scalar' => 'foo' );
12 # We now have an accessor method for an "inheritable" scalar value
13
14 package main;
15
16 MyClass->foo( 'Foozle' ); # Set a class-wide value
17 print MyClass->foo(); # Retrieve class-wide value
18 ...
19
20 package MySubClass;
21 @ISA = 'MyClass';
22
23 print MySubClass->foo(); # Intially same as superclass,
24 MySubClass->foo('Foobar'); # but overridable per subclass/
25
27 The MakeMethods subclass provides accessor methods that search an
28 inheritance tree to find a value. This allows you to set a shared or
29 default value for a given class, and optionally override it in a
30 subclass.
31
32 Standard Methods
33 The following methods from Generic should all be supported:
34
35 scalar
36 string
37 string_index (?)
38 number
39 boolean
40 bits (?)
41 array (*)
42 hash (*)
43 tiedhash (?)
44 hash_of_arrays (?)
45 object (?)
46 instance (?)
47 array_of_objects (?)
48 code (?)
49 code_or_scalar (?)
50
51 See Class::MakeMethods::Template::Generic for the interfaces and
52 behaviors of these method types.
53
54 The items marked with a * above are specifically defined in this
55 package, whereas the others are formed automatically by the interaction
56 of this package's generic settings with the code templates provided by
57 the Generic superclass.
58
59 The items marked with a ? above have not been tested sufficiently;
60 please inform the author if they do not function as you would expect.
61
63 See Class::MakeMethods for general information about this distribution.
64
65 See Class::MakeMethods::Template for more about this family of
66 subclasses.
67
68 See Class::MakeMethods::Template::Generic for information about the
69 various accessor interfaces subclassed herein.
70
71 If you just need scalar accessors, see Class::Data::Inheritable for a
72 very elegant and efficient implementation.
73
74
75
76perl v5.30.1 2020-01M-a2k9eMethods::Template::ClassInherit(3)