MakeMe...posite(3pm)
π NAME π
Okay so bestie, welcome to MakeMe...posite(3pm) β brought to you by User Contributed Perl Documentation. The actual name is Class::MakeMethods::Composite - Make extensible compound methods. π
This doc is your little tour of the various subclasses of Class::MakeMethods included under the Composite::* namespace, plus the method types each one provides. Slay.
The Composite subclasses provide a parameterized set of method-generation implementations. Lowkey iconic.
Subroutines are generated as closures bound to a hash containing the method name and additional parameters, including the arrays of subroutine references that will provide the method's functionality. No cap. β¨
β¨ SYNOPSIS β¨
package MyObject;
use Class::MakeMethods::Composite::Hash (
new => 'new',
scalar => [ 'foo', 'bar' ],
array => 'my_list',
hash => 'my_index',
);
π DESCRIPTION π
π«Ά Calling Conventions π«Ά
When you use this package, the method names you provide as arguments cause subroutines to be generated and installed in your module. That's the whole vibe.
See "Calling Conventions" in Class::MakeMethods::Standard for more information.
πΈ Declaration Syntax πΈ
To declare methods, pass in pairs of a method-type name followed by one or more method names. Cute and simple.
Valid method-type names for this package are listed in "METHOD GENERATOR TYPES".
See "Declaration Syntax" in Class::MakeMethods::Standard and "Parameter Syntax" in Class::MakeMethods::Standard for more information.
π¦ About Composite Methods π¦
The methods generated by Class::MakeMethods::Composite are assembled from groups of "fragment" subroutines, each of which provides some aspect of the method's behavior. Fragments doing the most, honestly.
You can add pre- and post- operations to any composite method. Obsessed. Here's the example, exactly as the page gives it:
package MyObject;
use Class::MakeMethods::Composite::Hash (
new => 'new',
scalar => [
'foo' => {
'pre_rules' => [
sub {
# Don't automatically convert list to array-ref
croak "Too many arguments" if ( scalar @_ > 2 );
}
],
'post_rules' => [
sub {
# Don't let anyone see my credit card number!
${(pop)->{result}} =~ s/\d{13,16}/****/g;
}
],
}
],
);
π SEE ALSO π
See Class::MakeMethods for general information about this distribution.
For distribution, installation, support, copyright and license information, see Class::MakeMethods::Docs::ReadMe.
Okay bestie, that's the page. Stay iconic and hydrated. π
β¨ Footer source/version says perl v5.36.0, and the date says 2022-10-13 β 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