MakeMe...s::ToDo(3pm)
π NAME π
Class::MakeMethods::Docs::ToDo β Ideas, problems, and suggestions. Also hi bestie, this is the MakeMe...s::ToDo(3pm) page from the User Contributed Perl Documentation, and it is literally the module's "we should do this" list. π«Ά
β¨ SYNOPSIS β¨
There are lots of things that could be done to improve this module. Like, lots lots. π
π DISTRIBUTION ISSUES π
Issues about the distribution and supporting files, rather than the code:
π Documentation π
- Make sure that the documentation is broken up into appropriately-sized chunks, and that people will know which section to look at.
- As user questions arrive, add the answers as documentation points or examples.
- Assemble annotated examples and tutorials, and either link to or distribute them.
- Finish overhauling Template documentation.
- Include Global and InsideOut uses in the EXAMPLES section
- Template Internals: Finish documenting disk-based meta-method code-caching.
π§ͺ Tests π§ͺ
- Use
Devel::Coverageto measure test coverage, and fill in missing cases. - Finish tests for Standard and Composite modules.
π₯ GENERAL ISSUES π₯
- It does not appear to be possible to assign subroutine names to closures within Perl. As a result, debugging output from
Carpand similar sources will show all generated methods as"ANON()"rather than"YourClass::methodname()".
UPDATE: There now seem to be fixes for this which should be integrated: See the new Sub::Name module and http://perlmonks.org/index.pl?node_id=304883
- For scalar methods (and others) it would be nice to have a simple bounds-checking interface to approve or reject (with an exception) new values that were passed in.
As pointed out by Terrence Brannon, the right interface to adopt is probably that of Attribute::Types:
use Class::MakeMethods::Standard::Hash (
'scalar' => [ 'count' => { TYPE => 'INTEGER' } ],
'scalar' => [ 'name' => { TYPE => qr/^[A-Z]\w*$/ } ],
'scalar' => [ 'account' => { TYPE => &checksum_account_number } ]
);
- Improve use of
_diagnostichooks for debugging. Add various"(Q)"debug diagnostics. - Finish building Inheritable array and object accessors.
- Finish building
Composite::*packages. - Resolve DESTROY-time issues with
Standard::Inheritable,Composite::Inheritable, andTemplate::InsideOut. - Add slice and splice functionality to
Standard::*:hashandComposite::*:hash.
π§ TEMPLATE CLASSES π§
π Template::Generic π
- Allow untyped object accesors if
"class"attribute is not set. (Suggested in Jan-01 NY Perl Seminar discussion.) - Standardize naming templates for array, hash, other method types.
Deprecate verb_x methods? Or at last make them consistently available both ways.
Make list methods consistent with hash_of_lists methods, in action, and in name (x_verb). Also for others (e.g., set_ clear_ boolean)
- Should default object template provide auto-create behavior on
->get()? - Generalize the
"Generic:scalar -init_and_get"interface to support memoizing values for other accessor types. - Consider adding hash
eachand array iterator methods, using a closure to provide iteration. - Add support for tied arrays & scalars, a la
tiedhash - Add
string_multiple_index. - Extend index methods to support weak indexes with
WeakRef. Perhaps just have it accept a hash ref to use as the index, and then allow people to pass in tied hashes? - Maybe make private or protected method
croakif they were called by amethod_initmethod which was called by an outside package.
Not entirely clear what the right semantics or security precautions are here...
π Template::Generic Subclasses π
- Finish building
code_or_scalarmeta-method. - Finish building
Class::MakeMethods::ClassInheritsubclass.
Need to work out how to capture changes for non-scalar values. For example, if a subclass inherits an array accessor and then pops it, is there some way to provide them with copy-on-write?
- Add enumerated string/number type.
Provide helper methods with map of associated values (ex $o->port = 80 ... $o->port_readable eq 'HTTP' ). Cf. code for earlier unpublished 'lookup' method type.
- For
StructBuiltin:- Add
-fatalflag to die if core func returns false / undef - Add
callmethod to recall method with alternative arguments. - Add
-nocallflag to not call core func on new.
- Add
- Replace
ClassName:static_hash_classnamewithClass:indexed_string.
π Template Internals π
- Figure out which modules, if any, should actually be using
AutoLoader. Probably justTemplate::Generic? - Give users a way to do meta-method code-caching in Perl library hierarchy, rather than in
/tmp/autoor other user-specified directory..
Provide mechanism for pre-generating these at install time.
Perhaps load these via do, rather than open/read/eval?
Perhaps pre-generate expanded libs with all of the -imports resolved?
- Support generating code files and loading them as needed.
This would be similar to Class::Classgen, except that we'd do the generation at run-time the first time it was required, rather than in a separate pass.
For example, given the following declaration:
package Foo::Bar;
Class::MakeMethods::Template::Hash->import(-codecache=>'auto', scalar=>'foo');
We should be able to write out the following file:
cat 'auto/Foo/Bar/methods-line-2.pl'
# NOTE: Generated for Foo::Bar by the Class::MakeMethods module.
# Changes made here will be lost when Foo::Bar is modified.
package Foo::Bar;
sub foo {
my $self = shift;
if ( scalar @_ ) {
$self->{'foo'} = shift();
}
$self->{'foo'}
}
Then on subsequent uses, we can just re-load the generated code:
require "auto/Foo/Bar/methods-line-2.pl";
To do this, we need to:
- Provide an option to select this if desired; maybe ...
import('-cache' => 'auto/', ...)? - Figure out which directory we can/should write into.
- Re-evaluate the textual code templates, without generating the closures. Substitute in any
_STATIC_ATTR_values. Make other_ATTR_values point to some public lookup table or package scalar. - Notice if the source file (or
Class::MakeMethodsmodules) has been updated more recently than the generated file.
π¦ SEE ALSO π¦
See Class::MakeMethods for general information about this distribution.
okay that's the whole vibe check, bestie π this page is from perl v5.36.0, dated 2022-10-13, and yes it's the MakeMe...s::ToDo(3pm) manual page. mwah π
π¦ where this page comes from
- ubuntu noble: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms