1MakeMethods::Template::USscearlaCro(n3t)ributed Perl DocMuamkeenMteatthioodns::Template::Scalar(3)
2
3
4
6 Class::MakeMethods::Template::Scalar - Methods for blessed scalars
7
9 package MyObject;
10 use Class::MakeMethods::Template::ExternalData (
11 new => 'new',
12 scalar => 'foo',
13 );
14
15 package main;
16
17 my $obj = MyObject->new( foo => "Foozle" );
18 print $obj->foo(); # Prints Foozle
19 $obj->foo("Bamboozle"); # Sets $$obj
20 print $obj->foo(); # Prints Bamboozle
21
23 Supports the Generic object constructor and accessors meta-method
24 types, but uses scalar refs as the underlying implementation type, so
25 only one accessor method can be used effectively.
26
27 Standard Methods
28 The following methods from Generic are all supported:
29
30 new
31 scalar
32 string
33 string_index
34 number
35 boolean
36 bits
37 array
38 hash
39 tiedhash
40 hash_of_arrays
41 object
42 instance
43 array_of_objects
44 code
45 code_or_scalar
46
47 See Class::MakeMethods::Template::Generic for the interfaces and
48 behaviors of these method types.
49
50 However, note that due to special nature of this package, all accessor
51 methods reference the same scalar value, so setting a value with one
52 method will overwrite the value retrieved by another.
53
54
55
56perl v5.32.1 2021-01-27 MakeMethods::Template::Scalar(3)