1MakeMethods::Docs::ToDoU(s3e)r Contributed Perl DocumentaMtaikoenMethods::Docs::ToDo(3)
2
3
4
6 Class::MakeMethods::Docs::ToDo - Ideas, problems, and suggestions
7
9 There are lots of things that could be done to improve this module.
10
12 Issues about the distribution and supporting files, rather than the
13 code:
14
15 Documentation
16
17 · Make sure that the documentation is broken up into appropriately-
18 sized chunks, and that people will know which section to look at.
19
20 · As user questions arrive, add the answers as documentation points
21 or examples.
22
23 · Assemble annotated examples and tutorials, and either link to or
24 distribute them.
25
26 · Finish overhauling Template documentation.
27
28 · Include Global and InsideOut uses in the EXAMPLES section
29
30 · Template Internals: Finish documenting disk-based meta-method
31 code-caching.
32
33 Tests
34
35 · Use Devel::Coverage to measure test coverage, and fill in missing
36 cases.
37
38 · Finish tests for Standard and Composite modules.
39
41 · It does not appear to be possible to assign subroutine names to
42 closures within Perl. As a result, debugging output from Carp and
43 similar sources will show all generated methods as "ANON()" rather
44 than "YourClass::methodname()".
45
46 UPDATE: There now seem to be fixes for this which should be inte‐
47 grated: See the new Sub::Name module and http://perl‐
48 monks.org/index.pl?node_id=304883
49
50 · For scalar methods (and others) it would be nice to have a simple
51 bounds-checking interface to approve or reject (with an exception)
52 new values that were passed in.
53
54 As pointed out by Terrence Brannon, the right interface to adopt is
55 probably that of Attribute::Types:
56
57 use Class::MakeMethods::Standard::Hash (
58 'scalar' => [ 'count' => { TYPE => 'INTEGER' } ],
59 'scalar' => [ 'name' => { TYPE => qr/^[A-Z]\w*$/ } ],
60 'scalar' => [ 'account' => { TYPE => &checksum_account_number } ]
61 );
62
63 · Improve use of _diagnostic hooks for debugging. Add various "(Q)"
64 debug diagnostics.
65
66 · Finish building Inheritable array and object accessors.
67
68 · Finish building Composite::* packages.
69
70 · Resolve DESTROY-time issues with Standard::Inheritable, Compos‐
71 ite::Inheritable, and Template::InsideOut.
72
73 · Add slice and splice functionality to Standard::*:hash and Compos‐
74 ite::*:hash.
75
77 Template::Generic
78
79 · Allow untyped object accesors if "class" attribute is not set.
80 (Suggested in Jan-01 NY Perl Seminar discussion.)
81
82 · Standardize naming templates for array, hash, other method types.
83
84 Deprecate verb_x methods? Or at last make them consistently avail‐
85 able both ways.
86
87 Make list methods consistent with hash_of_lists methods, in action,
88 and in name (x_verb). Also for others (e.g., set_ clear_ boolean)
89
90 · Should default object template provide auto-create behavior on
91 ->get()?
92
93 · Generalize the "Generic:scalar -init_and_get" interface to support
94 memoizing values for other accessor types.
95
96 · Consider adding hash each and array iterator methods, using a clo‐
97 sure to provide iteration.
98
99 · Add support for tied arrays & scalars, a la tiedhash
100
101 · Add string_multiple_index.
102
103 · Extend index methods to support weak indexes with WeakRef. Perhaps
104 just have it accept a hash ref to use as the index, and then allow
105 people to pass in tied hashes?
106
107 · Maybe make private or protected method croak if they were called by
108 a method_init method which was called by an outside package.
109
110 Not entirely clear what the right semantics or security precautions
111 are here...
112
113 Template::Generic Subclasses
114
115 · Finish building code_or_scalar meta-method.
116
117 · Finish building Class::MakeMethods::ClassInherit subclass.
118
119 Need to work out how to capture changes for non-scalar values. For
120 example, if a subclass inherits an array accessor and then pops it,
121 is there some way to provide them with copy-on-write?
122
123 · Add enumerated string/number type.
124
125 Provide helper methods with map of associated values (ex $o->port =
126 80 ... $o->port_readable eq 'HTTP' ). Cf. code for earlier unpub‐
127 lished 'lookup' method type.
128
129 · For StructBuiltin:
130
131 Add -fatal flag to die if core func returns false / undef Add call
132 method to recall method with alternative arguments. Add -nocall
133 flag to not call core func on new.
134
135 · Replace ClassName:static_hash_classname with Class:indexed_string.
136
137 Template Internals
138
139 · Figure out which modules, if any, should actually be using
140 AutoLoader. Probably just Template::Generic?
141
142 · Give users a way to do meta-method code-caching in Perl library
143 hierarchy, rather than in /tmp/auto or other user-specified direc‐
144 tory..
145
146 Provide mechanism for pre-generating these at install time.
147
148 Perhaps load these via do, rather than open/read/eval?
149
150 Perhaps pre-generate expanded libs with all of the -imports
151 resolved?
152
153 · Support generating code files and loading them as needed.
154
155 This would be similar to Class::Classgen, except that we'd do the
156 generation at run-time the first time it was required, rather than
157 in a separate pass.
158
159 For example, given the following declaration:
160
161 package Foo::Bar;
162 Class::MakeMethods::Template::Hash->import(-codecache=>'auto', scalar=>'foo');
163
164 We should be able to write out the following file:
165
166 cat 'auto/Foo/Bar/methods-line-2.pl'
167 # NOTE: Generated for Foo::Bar by the Class::MakeMethods module.
168 # Changes made here will be lost when Foo::Bar is modified.
169 package Foo::Bar;
170 sub foo {
171 my $self = shift;
172 if ( scalar @_ ) {
173 $self->{'foo'} = shift();
174 }
175 $self->{'foo'}
176 }
177
178 Then on subsequent uses, we can just re-load the generated code:
179
180 require "auto/Foo/Bar/methods-line-2.pl";
181
182 To do this, we need to:
183
184 · Provide an option to select this if desired; maybe ...
185 import('-cache' => 'auto/', ...)?
186
187 · Figure out which directory we can/should write into.
188
189 · Re-evaluate the textual code templates, without generating the
190 closures. Substitute in any _STATIC_ATTR_ values. Make other
191 _ATTR_ values point to some public lookup table or package
192 scalar.
193
194 · Notice if the source file (or Class::MakeMethods modules) has
195 been updated more recently than the generated file.
196
198 See Class::MakeMethods for general information about this distribution.
199
200
201
202perl v5.8.8 2004-09-06 MakeMethods::Docs::ToDo(3)