MakeMe...ideOut(3pm)
πΈ NAME πΈ
okay so bestie, welcome to the MakeMe...ideOut(3pm) page from User Contributed Perl Documentation. The main character is Class::MakeMethods::Template::InsideOut β external data, no cap. iykyk.
π SYNOPSIS π
package MyObject;
use Class::MakeMethods::Template::InsideOut (
scalar => [ 'foo', 'bar' ]
);
sub new { ... }
package main;
my $obj = MyObject->new( foo => "Foozle", bar => "Bozzle" );
print $obj->foo(); # Prints Foozle
$obj->bar("Bamboozle"); # Sets $obj's bar value
π¦ DESCRIPTION π¦
okay so this template supports the Generic object constructor and accessors meta-method types, but plot twist: it accepts any object as the underlying implementation type, with member data stored in external indices. slay.
Each method stores the values associated with various objects in a hash keyed by the object's stringified identity. Since that hash is accessible only from the generated closures, it is literally impossible for foreign code to manipulate those values except through the method interface. π₯
A DESTROY method is installed to remove data for expired objects from the various hashes.
π¨ bestie, listen: if the DESTROY method is not called, your program will not release this data and memory will be wasted. no cap.
π Common Parameters π
The following parameters are defined for InsideOut meta-methods.
dataβ an auto-vivified reference to a hash to be used to store the values for each object.
Note that using InsideOut meta-methods causes the installation of a DESTROY method in the calling class, which deallocates data for each instance when it is discarded.
π NOTE: This needs some more work to properly handle inheritance.
π Standard Methods π
The following methods from Generic are all supported:
scalar
string
string_index *
number
boolean
bits
array
hash
tiedhash
hash_of_arrays
object
instance
array_of_objects
code
code_or_scalar
See Class::MakeMethods::Template::Generic for the interfaces and behaviors of these method types.
The items marked with a * above are specifically defined in this package, whereas the others are formed automatically by the interaction of this package's generic settings with the code templates provided by the Generic superclass. iconic.
π boolean_index π
boolean_index => [ qw / foo bar baz / ]
Like InsideOut:boolean, boolean_index creates x, set_x, and clear_x methods. However, it also defines a class method find_x which returns a list of the objects which presently have the x-flag set to true. π
π§ Note that to free items from memory, you must clear these bits!
xoxo, bestie π this iconic page was brought to you by perl v5.36.0 and dated 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