1MakeMethods::Template::UIsnesridCeoOnuttr(i3b)uted PerlMDaokceuMmeetnhtoadtsi:o:nTemplate::InsideOut(3)
2
3
4
6 Class::MakeMethods::Template::InsideOut - External data
7
9 package MyObject;
10 use Class::MakeMethods::Template::InsideOut (
11 scalar => [ 'foo', 'bar' ]
12 );
13 sub new { ... }
14
15 package main;
16
17 my $obj = MyObject->new( foo => "Foozle", bar => "Bozzle" );
18 print $obj->foo(); # Prints Foozle
19 $obj->bar("Bamboozle"); # Sets $obj's bar value
20
22 Supports the Generic object constructor and accessors meta-method
23 types, but accepts any object as the underlying implementation type,
24 with member data stored in external indices.
25
26 Each method stores the values associated with various objects in an
27 hash keyed by the object's stringified identity. Since that hash is
28 accessible only from the generated closures, it is impossible for for‐
29 eign code to manipulate those values except through the method inter‐
30 face.
31
32 A DESTROY method is installed to remove data for expired objects from
33 the various hashes. (If the DESTROY method is not called, your program
34 will not release this data and memory will be wasted.)
35
36 Common Parameters: The following parameters are defined for InsideOut
37 meta-methods.
38
39 data
40 An auto-vivified reference to a hash to be used to store the values
41 for each object.
42
43 Note that using InsideOut meta-methods causes the installation of a
44 DESTROY method in the calling class, which deallocates data for each
45 instance when it is discarded.
46
47 NOTE: This needs some more work to properly handle inheritance.
48
49 Standard Methods
50
51 The following methods from Generic are all supported:
52
53 scalar
54 string
55 string_index *
56 number
57 boolean
58 bits
59 array
60 hash
61 tiedhash
62 hash_of_arrays
63 object
64 instance
65 array_of_objects
66 code
67 code_or_scalar
68
69 See Class::MakeMethods::Template::Generic for the interfaces and behav‐
70 iors of these method types.
71
72 The items marked with a * above are specifically defined in this pack‐
73 age, whereas the others are formed automatically by the interaction of
74 this package's generic settings with the code templates provided by the
75 Generic superclass.
76
77 boolean_index
78
79 boolean_index => [ qw / foo bar baz / ]
80
81 Like InsideOut:boolean, boolean_index creates x, set_x, and clear_x
82 methods. However, it also defines a class method find_x which returns a
83 list of the objects which presently have the x-flag set to true.
84
85 Note that to free items from memory, you must clear these bits!
86
87
88
89perl v5.8.8 2004-09-06MakeMethods::Template::InsideOut(3)